<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width">
    <title>Dollar and Cent - Underscore.js for Swift</title>
    <link rel="shortcut icon" href="/favicon.ico?v1">
    <!-- Flatdoc -->
    <script src="./javascripts/jquery.min.js"></script>
    <script src="./javascripts/legacy.js"></script>
    <script src="./javascripts/flatdoc.js"></script>
    <!-- Flatdoc theme -->
    <link href="./stylesheets/style.css" rel="stylesheet">
    <script src="./javascripts/script.js"></script>
    <!-- Meta -->
    <meta content="Dollar and Cent" property="og:title">
    <meta content="Dollar is a Swift library that provides useful functional programming helper methods without extending any built in objects. It is similar to Lo-Dash or Underscore in Javascript." name="description">
    <script>
        Flatdoc.run({
            fetcher: Flatdoc.file('README.md')
        });
    </script>
    <meta name="google-site-verification" content="2Yw-KMIr81XtjxhQ2CpnN_bmfU4TX41-rX0hbFE28Bo">
</head>

<body role="flatdoc">
    <div class="header">
        <div class="left">
            <h1>Dollar and Cent</h1>
            <ul>
                <li><a href="https://github.com/ankurp/Dollar.swift">View on GitHub</a>
                </li>
                <li><a href="https://github.com/ankurp/Dollar.swift/issues">Issues</a>
                </li>
            </ul>
        </div>
        <div class="right">
            <!-- GitHub buttons: see http://ghbtns.com -->
            <iframe src="//ghbtns.com/github-btn.html?user=ankurp&amp;repo=Dollar.swift&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
        </div>
    </div>
    <div class="content-root">
        <div class="menubar fixed">
            <div class="menu section" role="flatdoc-menu">
                <ul>
                    <li id="root-item" class="level-0">
                        <ul class="level-1" id="root-list">
                            <li id="dollar-item" class="level-1"><a id="dollar-link" href="#dollar" class="level-1">Dollar  </a>
                                <ul class="level-2" id="dollar-list">
                                    <li id="contents-item" class="level-2"><a id="contents-link" href="#contents" class="level-2 active">Contents</a></li>
                                </ul>
                            </li>
                            <li id="setup-item" class="level-1"><a id="setup-link" href="#setup" class="level-1">Setup</a>
                                <ul class="level-2" id="setup-list">
                                    <li id="using-cocoapods-version-0-36-x-or-greater-item" class="level-2"><a id="using-cocoapods-version-0-36-x-or-greater-link" href="#using-cocoapods-version-0-36-x-or-greater" class="level-2">Using cocoapods version 0.36.x or greater</a></li>
                                    <li id="using-swift-package-manager-item" class="level-2"><a id="using-swift-package-manager-link" href="#using-swift-package-manager" class="level-2">Using Swift Package Manager</a></li>
                                    <li id="using-git-submodule-item" class="level-2"><a id="using-git-submodule-link" href="#using-git-submodule" class="level-2">Using git submodule</a></li>
                                    <li id="support-for-xcode-and-swift-item" class="level-2"><a id="support-for-xcode-and-swift-link" href="#support-for-xcode-and-swift" class="level-2">Support for Xcode and Swift</a></li>
                                    <li id="demo-apps-item" class="level-2"><a id="demo-apps-link" href="#demo-apps" class="level-2">Demo Apps</a></li>
                                    <li id="communication-item" class="level-2"><a id="communication-link" href="#communication" class="level-2">Communication</a></li>
                                </ul>
                            </li>
                            <li id="dollar-usage-item" class="level-1"><a id="dollar-usage-link" href="#dollar-usage" class="level-1">Dollar Usage</a>
                                <ul class="level-2" id="dollar-usage-list">
                                    <li id="array-item" class="level-2"><a id="array-link" href="#array" class="level-2">Array</a>
                                        <ul class="level-3" id="array-list">
                                            <li id="at-dollar-at-item" class="level-3"><a id="at-dollar-at-link" href="#at-dollar-at" class="level-3">at - Dollar.at</a></li>
                                            <li id="chunk-dollar-chunk-item" class="level-3"><a id="chunk-dollar-chunk-link" href="#chunk-dollar-chunk" class="level-3">chunk - Dollar.chunk</a></li>
                                            <li id="compact-dollar-compact-item" class="level-3"><a id="compact-dollar-compact-link" href="#compact-dollar-compact" class="level-3">compact - Dollar.compact</a></li>
                                            <li id="contains-dollar-contains-item" class="level-3"><a id="contains-dollar-contains-link" href="#contains-dollar-contains" class="level-3">contains - Dollar.contains</a></li>
                                            <li id="cycle-dollar-cycle-item" class="level-3"><a id="cycle-dollar-cycle-link" href="#cycle-dollar-cycle" class="level-3">cycle - Dollar.cycle</a></li>
                                            <li id="difference-dollar-difference-item" class="level-3"><a id="difference-dollar-difference-link" href="#difference-dollar-difference" class="level-3">difference - Dollar.difference</a></li>
                                            <li id="each-dollar-each-item" class="level-3"><a id="each-dollar-each-link" href="#each-dollar-each" class="level-3">each - Dollar.each</a></li>
                                            <li id="every-dollar-every-item" class="level-3"><a id="every-dollar-every-link" href="#every-dollar-every" class="level-3">every - Dollar.every</a></li>
                                            <li id="factorial-dollar-factorial-item" class="level-3"><a id="factorial-dollar-factorial-link" href="#factorial-dollar-factorial" class="level-3">factorial Dollar.factorial</a></li>
                                            <li id="fetch-dollar-fetch-item" class="level-3"><a id="fetch-dollar-fetch-link" href="#fetch-dollar-fetch" class="level-3">fetch - Dollar.fetch</a></li>
                                            <li id="fill-dollar-fill-item" class="level-3"><a id="fill-dollar-fill-link" href="#fill-dollar-fill" class="level-3">fill - Dollar.fill</a></li>
                                            <li id="find-dollar-find-item" class="level-3"><a id="find-dollar-find-link" href="#find-dollar-find" class="level-3">find - Dollar.find</a></li>
                                            <li id="findindex-dollar-findindex-item" class="level-3"><a id="findindex-dollar-findindex-link" href="#findindex-dollar-findindex" class="level-3">findIndex - Dollar.findIndex</a></li>
                                            <li id="findlastindex-dollar-findlastindex-item" class="level-3"><a id="findlastindex-dollar-findlastindex-link" href="#findlastindex-dollar-findlastindex" class="level-3">findLastIndex - Dollar.findLastIndex</a></li>
                                            <li id="first-dollar-first-array-anyobject-item" class="level-3"><a id="first-dollar-first-array-anyobject-link" href="#first-dollar-first-array-anyobject" class="level-3">first - Dollar.first(array: AnyObject[])</a></li>
                                            <li id="groupby-dollar-groupby-item" class="level-3"><a id="groupby-dollar-groupby-link" href="#groupby-dollar-groupby" class="level-3">groupBy Dollar.groupBy</a></li>
                                            <li id="second-dollar-second-array-anyobject-item" class="level-3"><a id="second-dollar-second-array-anyobject-link" href="#second-dollar-second-array-anyobject" class="level-3">second - Dollar.second(array: AnyObject[])</a></li>
                                            <li id="flatmap-dollar-flatmap-item" class="level-3"><a id="flatmap-dollar-flatmap-link" href="#flatmap-dollar-flatmap" class="level-3">flatMap - Dollar.flatMap</a></li>
                                            <li id="flatmap-dollar-flatmap-item" class="level-3"><a id="flatmap-dollar-flatmap-link" href="#flatmap-dollar-flatmap" class="level-3">flatMap - Dollar.flatMap</a></li>
                                            <li id="flatten-dollar-flatten-item" class="level-3"><a id="flatten-dollar-flatten-link" href="#flatten-dollar-flatten" class="level-3">flatten - Dollar.flatten</a></li>
                                            <li id="frequencies-dollar-frequencies-item" class="level-3"><a id="frequencies-dollar-frequencies-link" href="#frequencies-dollar-frequencies" class="level-3">frequencies - Dollar.frequencies</a></li>
                                            <li id="gcd-dollar-gcd-item" class="level-3"><a id="gcd-dollar-gcd-link" href="#gcd-dollar-gcd" class="level-3">gcd Dollar.gcd</a></li>
                                            <li id="indexof-dollar-indexof-item" class="level-3"><a id="indexof-dollar-indexof-link" href="#indexof-dollar-indexof" class="level-3">indexOf - Dollar.indexOf</a></li>
                                            <li id="initial-dollar-initial-item" class="level-3"><a id="initial-dollar-initial-link" href="#initial-dollar-initial" class="level-3">initial - Dollar.initial</a></li>
                                            <li id="intersection-dollar-intersection-item" class="level-3"><a id="intersection-dollar-intersection-link" href="#intersection-dollar-intersection" class="level-3">intersection - Dollar.intersection</a></li>
                                            <li id="it-isin-dollar-it-t-comparable-i-t-isin-range-range-t-item" class="level-3"><a id="it-isin-dollar-it-t-comparable-i-t-isin-range-range-t-link" href="#it-isin-dollar-it-t-comparable-i-t-isin-range-range-t" class="level-3">it-isIn Dollar.it<t: comparable="">(i: T, isIn range: Range<t>)</t></t:></a></li>
                                            <li id="last-dollar-last-item" class="level-3"><a id="last-dollar-last-link" href="#last-dollar-last" class="level-3">last - Dollar.last</a></li>
                                            <li id="lastindexof-dollar-lastindexof-item" class="level-3"><a id="lastindexof-dollar-lastindexof-link" href="#lastindexof-dollar-lastindexof" class="level-3">lastIndexOf - Dollar.lastIndexOf</a></li>
                                            <li id="lcm-dollar-lcm-item" class="level-3"><a id="lcm-dollar-lcm-link" href="#lcm-dollar-lcm" class="level-3">lcm Dollar.lcm</a></li>
                                            <li id="rest-dollar-rest-item" class="level-3"><a id="rest-dollar-rest-link" href="#rest-dollar-rest" class="level-3">rest - Dollar.rest</a></li>
                                            <li id="map-dollar-map-item" class="level-3"><a id="map-dollar-map-link" href="#map-dollar-map" class="level-3">map - Dollar.map</a></li>
                                            <li id="min-dollar-min-item" class="level-3"><a id="min-dollar-min-link" href="#min-dollar-min" class="level-3">min - Dollar.min</a></li>
                                            <li id="max-dollar-max-item" class="level-3"><a id="max-dollar-max-link" href="#max-dollar-max" class="level-3">max - Dollar.max</a></li>
                                            <li id="pluck-dollar-pluck-item" class="level-3"><a id="pluck-dollar-pluck-link" href="#pluck-dollar-pluck" class="level-3">pluck - Dollar.pluck</a></li>
                                            <li id="pull-dollar-pull-item" class="level-3"><a id="pull-dollar-pull-link" href="#pull-dollar-pull" class="level-3">pull - Dollar.pull</a></li>
                                            <li id="pullat-dollar-pullat-item" class="level-3"><a id="pullat-dollar-pullat-link" href="#pullat-dollar-pullat" class="level-3">pullAt - Dollar.pullAt</a></li>
                                            <li id="range-dollar-range-item" class="level-3"><a id="range-dollar-range-link" href="#range-dollar-range" class="level-3">range - Dollar.range</a></li>
                                            <li id="reduce-dollar-reduce-item" class="level-3"><a id="reduce-dollar-reduce-link" href="#reduce-dollar-reduce" class="level-3">reduce - Dollar.reduce</a></li>
                                            <li id="sample-dollar-sample-item" class="level-3"><a id="sample-dollar-sample-link" href="#sample-dollar-sample" class="level-3">sample - Dollar.sample</a></li>
                                            <li id="sequence-dollar-sequence-item" class="level-3"><a id="sequence-dollar-sequence-link" href="#sequence-dollar-sequence" class="level-3">sequence - Dollar.sequence</a></li>
                                            <li id="remove-dollar-remove-item" class="level-3"><a id="remove-dollar-remove-link" href="#remove-dollar-remove" class="level-3">remove - Dollar.remove</a></li>
                                            <li id="remove-dollar-remove-item" class="level-3"><a id="remove-dollar-remove-link" href="#remove-dollar-remove" class="level-3">remove - Dollar.remove</a></li>
                                            <li id="shuffle-dollar-shuffle-item" class="level-3"><a id="shuffle-dollar-shuffle-link" href="#shuffle-dollar-shuffle" class="level-3">shuffle - Dollar.shuffle</a></li>
                                            <li id="size-dollar-size-item" class="level-3"><a id="size-dollar-size-link" href="#size-dollar-size" class="level-3">size - Dollar.size</a></li>
                                            <li id="sortedindex-dollar-sortedindex-item" class="level-3"><a id="sortedindex-dollar-sortedindex-link" href="#sortedindex-dollar-sortedindex" class="level-3">sortedIndex - Dollar.sortedIndex</a></li>
                                            <li id="transpose-dollar-transpose-item" class="level-3"><a id="transpose-dollar-transpose-link" href="#transpose-dollar-transpose" class="level-3">transpose - Dollar.transpose</a></li>
                                            <li id="union-dollar-union-item" class="level-3"><a id="union-dollar-union-link" href="#union-dollar-union" class="level-3">union - Dollar.union</a></li>
                                            <li id="merge-dollar-merge-item" class="level-3"><a id="merge-dollar-merge-link" href="#merge-dollar-merge" class="level-3">merge - Dollar.merge</a></li>
                                            <li id="uniq-dollar-uniq-item" class="level-3"><a id="uniq-dollar-uniq-link" href="#uniq-dollar-uniq" class="level-3">uniq - Dollar.uniq</a></li>
                                            <li id="without-dollar-without-item" class="level-3"><a id="without-dollar-without-link" href="#without-dollar-without" class="level-3">without - Dollar.without</a></li>
                                            <li id="xor-dollar-xor-item" class="level-3"><a id="xor-dollar-xor-link" href="#xor-dollar-xor" class="level-3">xor - Dollar.xor</a></li>
                                            <li id="zip-dollar-zip-item" class="level-3"><a id="zip-dollar-zip-link" href="#zip-dollar-zip" class="level-3">zip - Dollar.zip</a></li>
                                            <li id="zipobject-dollar-zipobject-item" class="level-3"><a id="zipobject-dollar-zipobject-link" href="#zipobject-dollar-zipobject" class="level-3">zipObject - Dollar.zipObject</a></li>
                                            <li id="partition-dollar-partition-item" class="level-3"><a id="partition-dollar-partition-link" href="#partition-dollar-partition" class="level-3">partition - Dollar.partition</a></li>
                                            <li id="partitionall-dollar-partitionall-item" class="level-3"><a id="partitionall-dollar-partitionall-link" href="#partitionall-dollar-partitionall" class="level-3">partitionAll - Dollar.partitionAll</a></li>
                                            <li id="partitionby-dollar-partitionby-item" class="level-3"><a id="partitionby-dollar-partitionby-link" href="#partitionby-dollar-partitionby" class="level-3">partitionBy - Dollar.partitionBy</a></li>
                                        </ul>
                                    </li>
                                    <li id="dictionary-item" class="level-2"><a id="dictionary-link" href="#dictionary" class="level-2">Dictionary</a>
                                        <ul class="level-3" id="dictionary-list">
                                            <li id="keys-dollar-keys-item" class="level-3"><a id="keys-dollar-keys-link" href="#keys-dollar-keys" class="level-3">keys - Dollar.keys</a></li>
                                            <li id="values-dollar-values-item" class="level-3"><a id="values-dollar-values-link" href="#values-dollar-values" class="level-3">values - Dollar.values</a></li>
                                            <li id="merge-dollar-merge-item" class="level-3"><a id="merge-dollar-merge-link" href="#merge-dollar-merge" class="level-3">merge - Dollar.merge</a></li>
                                            <li id="pick-dollar-pick-item" class="level-3"><a id="pick-dollar-pick-link" href="#pick-dollar-pick" class="level-3">pick - Dollar.pick</a></li>
                                            <li id="omit-dollar-omit-item" class="level-3"><a id="omit-dollar-omit-link" href="#omit-dollar-omit" class="level-3">omit - Dollar.omit</a></li>
                                        </ul>
                                    </li>
                                    <li id="object-item" class="level-2"><a id="object-link" href="#object" class="level-2">Object</a>
                                        <ul class="level-3" id="object-list">
                                            <li id="tap-dollar-tap-item" class="level-3"><a id="tap-dollar-tap-link" href="#tap-dollar-tap" class="level-3">tap - Dollar.tap</a></li>
                                        </ul>
                                    </li>
                                    <li id="function-item" class="level-2"><a id="function-link" href="#function" class="level-2">Function</a>
                                        <ul class="level-3" id="function-list">
                                            <li id="after-dollar-after-item" class="level-3"><a id="after-dollar-after-link" href="#after-dollar-after" class="level-3">after - Dollar.after</a></li>
                                            <li id="bind-dollar-bind-item" class="level-3"><a id="bind-dollar-bind-link" href="#bind-dollar-bind" class="level-3">bind - Dollar.bind</a></li>
                                            <li id="compose-dollar-compose-item" class="level-3"><a id="compose-dollar-compose-link" href="#compose-dollar-compose" class="level-3">compose - Dollar.compose</a></li>
                                            <li id="curry-dollar-curry-item" class="level-3"><a id="curry-dollar-curry-link" href="#curry-dollar-curry" class="level-3">curry - Dollar.curry</a></li>
                                            <li id="id-dollar-id-item" class="level-3"><a id="id-dollar-id-link" href="#id-dollar-id" class="level-3">id - Dollar.id</a></li>
                                            <li id="memoize-dollar-memoize-item" class="level-3"><a id="memoize-dollar-memoize-link" href="#memoize-dollar-memoize" class="level-3">memoize - Dollar.memoize</a></li>
                                            <li id="noop-dollar-noop-item" class="level-3"><a id="noop-dollar-noop-link" href="#noop-dollar-noop" class="level-3">noop - Dollar.noop</a></li>
                                            <li id="now-dollar-now-item" class="level-3"><a id="now-dollar-now-link" href="#now-dollar-now" class="level-3">now - Dollar.now</a></li>
                                            <li id="once-dollar-once-item" class="level-3"><a id="once-dollar-once-link" href="#once-dollar-once" class="level-3">once - Dollar.once</a></li>
                                            <li id="partial-dollar-partial-item" class="level-3"><a id="partial-dollar-partial-link" href="#partial-dollar-partial" class="level-3">partial - Dollar.partial</a></li>
                                            <li id="times-dollar-times-item" class="level-3"><a id="times-dollar-times-link" href="#times-dollar-times" class="level-3">times - Dollar.times</a></li>
                                        </ul>
                                    </li>
                                    <li id="chaining-item" class="level-2"><a id="chaining-link" href="#chaining" class="level-2">Chaining</a>
                                        <ul class="level-3" id="chaining-list">
                                            <li id="any-item" class="level-3"><a id="any-link" href="#any" class="level-3">any</a></li>
                                            <li id="all-item" class="level-3"><a id="all-link" href="#all" class="level-3">all</a></li>
                                            <li id="each-item" class="level-3"><a id="each-link" href="#each" class="level-3">each</a></li>
                                            <li id="filter-item" class="level-3"><a id="filter-link" href="#filter" class="level-3">filter</a></li>
                                            <li id="first-item" class="level-3"><a id="first-link" href="#first" class="level-3">first</a></li>
                                            <li id="second-item" class="level-3"><a id="second-link" href="#second" class="level-3">second</a></li>
                                            <li id="third-item" class="level-3"><a id="third-link" href="#third" class="level-3">third</a></li>
                                            <li id="flatten-item" class="level-3"><a id="flatten-link" href="#flatten" class="level-3">flatten</a></li>
                                            <li id="initial-item" class="level-3"><a id="initial-link" href="#initial" class="level-3">initial</a></li>
                                            <li id="map-item" class="level-3"><a id="map-link" href="#map" class="level-3">map</a></li>
                                            <li id="size-item" class="level-3"><a id="size-link" href="#size" class="level-3">size</a></li>
                                            <li id="slice-item" class="level-3"><a id="slice-link" href="#slice" class="level-3">slice</a></li>
                                            <li id="value-item" class="level-3"><a id="value-link" href="#value" class="level-3">value</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </li>
                            <li id="cent-usage-item" class="level-1"><a id="cent-usage-link" href="#cent-usage" class="level-1">Cent Usage</a>
                                <ul class="level-2" id="cent-usage-list">
                                    <li id="array-extensions-item" class="level-2"><a id="array-extensions-link" href="#array-extensions" class="level-2">Array Extensions</a>
                                        <ul class="level-3" id="array-extensions-list">
                                            <li id="elem-element-element-item" class="level-3"><a id="elem-element-element-link" href="#elem-element-element" class="level-3">&lt;&lt; elem: Element -&gt; [Element]</a></li>
                                            <li id="at-indexes-int-element-item" class="level-3"><a id="at-indexes-int-element-link" href="#at-indexes-int-element" class="level-3">at(indexes: Int...) -&gt; [Element]</a></li>
                                            <li id="each-callback-element-element-item" class="level-3"><a id="each-callback-element-element-link" href="#each-callback-element-element" class="level-3">each(callback: (Element) -&gt; ()) -&gt; [Element]</a></li>
                                            <li id="eachwithindex-callback-int-element-element-item" class="level-3"><a id="eachwithindex-callback-int-element-element-link" href="#eachwithindex-callback-int-element-element" class="level-3">eachWithIndex(callback: (Int, Element) -&gt; ()) -&gt; [Element]</a></li>
                                            <li id="cycle-u-times-int-callback-element-u-item" class="level-3"><a id="cycle-u-times-int-callback-element-u-link" href="#cycle-u-times-int-callback-element-u" class="level-3">cycle<u>(times: Int, callback: (Element) -&gt; U)</u></a></li>
                                            <li id="every-callback-element-bool-bool-item" class="level-3"><a id="every-callback-element-bool-bool-link" href="#every-callback-element-bool-bool" class="level-3">every(callback: (Element) -&gt; Bool) -&gt; Bool</a></li>
                                            <li id="indexof-t-equatable-value-t-int-item" class="level-3"><a id="indexof-t-equatable-value-t-int-link" href="#indexof-t-equatable-value-t-int" class="level-3">indexOf<t: equatable="">(value: T) -&gt; Int</t:></a></li>
                                            <li id="fetch-index-int-orelse-t-none-t-item" class="level-3"><a id="fetch-index-int-orelse-t-none-t-link" href="#fetch-index-int-orelse-t-none-t" class="level-3">fetch(index: Int, orElse: T? = .None) -&gt; T!</a></li>
                                            <li id="findindex-callback-element-bool-int-item" class="level-3"><a id="findindex-callback-element-bool-int-link" href="#findindex-callback-element-bool-int" class="level-3">findIndex(callback: (Element) -&gt; Bool) -&gt; Int?</a></li>
                                            <li id="findlastindex-callback-element-bool-int-item" class="level-3"><a id="findlastindex-callback-element-bool-int-link" href="#findlastindex-callback-element-bool-int" class="level-3">findLastIndex(callback: (Element) -&gt; Bool) -&gt; Int?</a></li>
                                            <li id="first-element-item" class="level-3"><a id="first-element-link" href="#first-element" class="level-3">first() -&gt; Element?</a></li>
                                            <li id="flatten-element-item" class="level-3"><a id="flatten-element-link" href="#flatten-element" class="level-3">flatten() -&gt; [Element]</a></li>
                                            <li id="get-index-int-element-item" class="level-3"><a id="get-index-int-element-link" href="#get-index-int-element" class="level-3">get(index: Int) -&gt; Element?</a></li>
                                            <li id="initial-numelements-int-1-element-item" class="level-3"><a id="initial-numelements-int-1-element-link" href="#initial-numelements-int-1-element" class="level-3">initial(numElements: Int? = 1) -&gt; [Element]</a></li>
                                            <li id="last-element-item" class="level-3"><a id="last-element-link" href="#last-element" class="level-3">last() -&gt; Element?</a></li>
                                            <li id="rest-numelements-int-1-element-item" class="level-3"><a id="rest-numelements-int-1-element-link" href="#rest-numelements-int-1-element" class="level-3">rest(numElements: Int? = 1) -&gt; [Element]</a></li>
                                            <li id="min-t-comparable-t-item" class="level-3"><a id="min-t-comparable-t-link" href="#min-t-comparable-t" class="level-3">min<t: comparable="">() -&gt; T?</t:></a></li>
                                            <li id="max-t-comparable-t-item" class="level-3"><a id="max-t-comparable-t-link" href="#max-t-comparable-t" class="level-3">max<t: comparable="">() -&gt; T?</t:></a></li>
                                            <li id="remove-t-equatable-value-t-t-item" class="level-3"><a id="remove-t-equatable-value-t-t-link" href="#remove-t-equatable-value-t-t" class="level-3">remove<t: equatable="">(value: T) -&gt; T?</t:></a></li>
                                            <li id="contains-t-equatable-value-t-bool-item" class="level-3"><a id="contains-t-equatable-value-t-bool-link" href="#contains-t-equatable-value-t-bool" class="level-3">contains<t:equatable>(value: T) -&gt; Bool</t:equatable></a></li>
                                        </ul>
                                    </li>
                                    <li id="character-extensions-item" class="level-2"><a id="character-extensions-link" href="#character-extensions" class="level-2">Character Extensions</a>
                                        <ul class="level-3" id="character-extensions-list">
                                            <li id="a-description-string-item" class="level-3"><a id="a-description-string-link" href="#a-description-string" class="level-3">"A".description -&gt; String</a></li>
                                            <li id="a-ord-int-item" class="level-3"><a id="a-ord-int-link" href="#a-ord-int" class="level-3">"A".ord -&gt; Int</a></li>
                                        </ul>
                                    </li>
                                    <li id="date-extensions-item" class="level-2"><a id="date-extensions-link" href="#date-extensions" class="level-2">Date Extensions</a>
                                        <ul class="level-3" id="date-extensions-list">
                                            <li id="date-from-year-int-month-int-day-int-nsdate-item" class="level-3"><a id="date-from-year-int-month-int-day-int-nsdate-link" href="#date-from-year-int-month-int-day-int-nsdate" class="level-3">Date.from(#year: Int, month: Int, day: Int) -&gt; NSDate</a></li>
                                            <li id="date-from-unix-double-nsdate-item" class="level-3"><a id="date-from-unix-double-nsdate-link" href="#date-from-unix-double-nsdate" class="level-3">Date.from(#unix: Double) -&gt; NSDate</a></li>
                                            <li id="date-parse-datestr-string-format-string-yyyy-mm-dd-nsdate-item" class="level-3"><a id="date-parse-datestr-string-format-string-yyyy-mm-dd-nsdate-link" href="#date-parse-datestr-string-format-string-yyyy-mm-dd-nsdate" class="level-3">Date.parse(dateStr: String, format: String = "yyyy-MM-dd") -&gt; NSDate</a></li>
                                            <li id="date-unix-date-nsdate-nsdate-double-item" class="level-3"><a id="date-unix-date-nsdate-nsdate-double-link" href="#date-unix-date-nsdate-nsdate-double" class="level-3">Date.unix(date: NSDate = NSDate()) -&gt; Double</a></li>
                                            <li id="int-hour-fromnow-et-al-item" class="level-3"><a id="int-hour-fromnow-et-al-link" href="#int-hour-fromnow-et-al" class="level-3">Int.hour.fromNow et al.</a></li>
                                        </ul>
                                    </li>
                                    <li id="dictionary-extensions-item" class="level-2"><a id="dictionary-extensions-link" href="#dictionary-extensions" class="level-2">Dictionary Extensions</a>
                                        <ul class="level-3" id="dictionary-extensions-list">
                                            <li id="merge-k-v-dictionaries-dictionary-k-v-item" class="level-3"><a id="merge-k-v-dictionaries-dictionary-k-v-link" href="#merge-k-v-dictionaries-dictionary-k-v" class="level-3">merge<k, v="">(dictionaries: Dictionary<k, v="">...)</k,></k,></a></li>
                                        </ul>
                                    </li>
                                    <li id="int-extensions-item" class="level-2"><a id="int-extensions-link" href="#int-extensions" class="level-2">Int Extensions</a>
                                        <ul class="level-3" id="int-extensions-list">
                                            <li id="times-callback-int-item" class="level-3"><a id="times-callback-int-link" href="#times-callback-int" class="level-3">times(callback: (Int) -&gt; ())</a></li>
                                            <li id="times-function-item" class="level-3"><a id="times-function-link" href="#times-function" class="level-3">times (function: () -&gt; ())</a></li>
                                            <li id="char-character-item" class="level-3"><a id="char-character-link" href="#char-character" class="level-3">char -&gt; Character</a></li>
                                            <li id="iseven-item" class="level-3"><a id="iseven-link" href="#iseven" class="level-3">isEven</a></li>
                                            <li id="isodd-item" class="level-3"><a id="isodd-link" href="#isodd" class="level-3">isOdd</a></li>
                                            <li id="digits-int-item" class="level-3"><a id="digits-int-link" href="#digits-int" class="level-3">digits() -&gt; [Int]</a></li>
                                            <li id="lcm-int-item" class="level-3"><a id="lcm-int-link" href="#lcm-int" class="level-3">lcm() -&gt; Int</a></li>
                                            <li id="gcd-int-item" class="level-3"><a id="gcd-int-link" href="#gcd-int" class="level-3">gcd() -&gt; Int</a></li>
                                            <li id="random-int-item" class="level-3"><a id="random-int-link" href="#random-int" class="level-3">random() -&gt; Int</a></li>
                                            <li id="factorial-int-item" class="level-3"><a id="factorial-int-link" href="#factorial-int" class="level-3">factorial() -&gt; Int</a></li>
                                            <li id="isin-interval-bool-item" class="level-3"><a id="isin-interval-bool-link" href="#isin-interval-bool" class="level-3">isIn(interval) -&gt; Bool</a></li>
                                            <li id="next-int-item" class="level-3"><a id="next-int-link" href="#next-int" class="level-3">next() -&gt; Int</a></li>
                                            <li id="prev-int-item" class="level-3"><a id="prev-int-link" href="#prev-int" class="level-3">prev() -&gt; Int</a></li>
                                            <li id="upto-limit-int-callback-item" class="level-3"><a id="upto-limit-int-callback-link" href="#upto-limit-int-callback" class="level-3">upTo(limit: Int, callback: () -&gt; ())</a></li>
                                            <li id="downto-limit-int-callback-item" class="level-3"><a id="downto-limit-int-callback-link" href="#downto-limit-int-callback" class="level-3">downTo(limit: Int, callback: () -&gt; ())</a></li>
                                        </ul>
                                    </li>
                                    <li id="string-extensions-item" class="level-2"><a id="string-extensions-link" href="#string-extensions" class="level-2">String Extensions</a>
                                        <ul class="level-3" id="string-extensions-list">
                                            <li id="length-item" class="level-3"><a id="length-link" href="#length" class="level-3">.length</a></li>
                                            <li id="camelcase-item" class="level-3"><a id="camelcase-link" href="#camelcase" class="level-3">.camelCase</a></li>
                                            <li id="kebabcase-item" class="level-3"><a id="kebabcase-link" href="#kebabcase" class="level-3">.kebabCase</a></li>
                                            <li id="snakecase-item" class="level-3"><a id="snakecase-link" href="#snakecase" class="level-3">.snakeCase</a></li>
                                            <li id="startcase-item" class="level-3"><a id="startcase-link" href="#startcase" class="level-3">.startCase</a></li>
                                            <li id="str-string-bool-item" class="level-3"><a id="str-string-bool-link" href="#str-string-bool" class="level-3">=~ str: String -&gt; Bool</a></li>
                                            <li id="n-int-string-item" class="level-3"><a id="n-int-string-link" href="#n-int-string" class="level-3">* n: Int -&gt; String</a></li>
                                            <li id="i-int-character-item" class="level-3"><a id="i-int-character-link" href="#i-int-character" class="level-3">[i: Int] -&gt; Character?</a></li>
                                            <li id="str-string-string-item" class="level-3"><a id="str-string-string-link" href="#str-string-string" class="level-3">[str: String] -&gt; String?</a></li>
                                            <li id="r-range-int-string-item" class="level-3"><a id="r-range-int-string-link" href="#r-range-int-string" class="level-3">[r: Range<int>] -&gt; String</int></a></li>
                                            <li id="indexof-char-character-int-item" class="level-3"><a id="indexof-char-character-int-link" href="#indexof-char-character-int" class="level-3">indexOf(char: Character) -&gt; Int?</a></li>
                                            <li id="indexof-str-string-int-item" class="level-3"><a id="indexof-str-string-int-link" href="#indexof-str-string-int" class="level-3">indexOf(str: String) -&gt; Int?</a></li>
                                            <li id="indexof-pattern-string-int-item" class="level-3"><a id="indexof-pattern-string-int-link" href="#indexof-pattern-string-int" class="level-3">indexOf(pattern: String) -&gt; Int?</a></li>
                                            <li id="split-delimiter-character-string-item" class="level-3"><a id="split-delimiter-character-string-link" href="#split-delimiter-character-string" class="level-3">split(delimiter: Character) -&gt; [String]</a></li>
                                            <li id="lstrip-string-item" class="level-3"><a id="lstrip-string-link" href="#lstrip-string" class="level-3">lstrip() -&gt; String</a></li>
                                            <li id="rstrip-string-item" class="level-3"><a id="rstrip-string-link" href="#rstrip-string" class="level-3">rstrip() -&gt; String</a></li>
                                            <li id="strip-string-item" class="level-3"><a id="strip-string-link" href="#strip-string" class="level-3">strip() -&gt; String</a></li>
                                        </ul>
                                    </li>
                                    <li id="regex-item" class="level-2"><a id="regex-link" href="#regex" class="level-2">Regex</a>
                                        <ul class="level-3" id="regex-list">
                                            <li id="init-item" class="level-3"><a id="init-link" href="#init" class="level-3">init</a></li>
                                            <li id="matches-teststr-string-anyobject-item" class="level-3"><a id="matches-teststr-string-anyobject-link" href="#matches-teststr-string-anyobject" class="level-3">matches(testStr: String) -&gt; [AnyObject]</a></li>
                                            <li id="test-teststr-string-bool-item" class="level-3"><a id="test-teststr-string-bool-link" href="#test-teststr-string-bool" class="level-3">test(testStr: String) -&gt; Bool</a></li>
                                            <li id="escapestr-str-string-string-item" class="level-3"><a id="escapestr-str-string-string-link" href="#escapestr-str-string-string" class="level-3">escapeStr(str: String) -&gt; String</a></li>
                                        </ul>
                                    </li>
                                    <li id="range-extensions-item" class="level-2"><a id="range-extensions-link" href="#range-extensions" class="level-2">Range Extensions</a>
                                        <ul class="level-3" id="range-extensions-list">
                                            <li id="equals-item" class="level-3"><a id="equals-link" href="#equals" class="level-3">equals - ==</a></li>
                                            <li id="eachwithindex-callback-t-item" class="level-3"><a id="eachwithindex-callback-t-link" href="#eachwithindex-callback-t" class="level-3">eachWithIndex(callback: (T) -&gt; ())</a></li>
                                            <li id="each-callback-item" class="level-3"><a id="each-callback-link" href="#each-callback" class="level-3">each(callback: () -&gt; ())</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </li>
                            <li id="contributing-item" class="level-1"><a id="contributing-link" href="#contributing" class="level-1">Contributing</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
        <div role="flatdoc-content" class="content">
            <h1 id="dollar">Dollar <a href="https://travis-ci.org/ankurp/Dollar"><img src="https://travis-ci.org/ankurp/Dollar.svg" alt="Build Status"></a> <img src="https://img.shields.io/cocoapods/v/Dollar.svg" alt="CocoaPods"></h1>
            <p>
                <a href="https://gitter.im/ankurp/Dollar?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter"></a>
            </p>
            <p>Dollar is a Swift library that provides useful functional programming helper methods without extending any built in objects. It is similar to <a href="https://lodash.com">Lo-Dash</a> or <a href="http://underscorejs.org">Underscore.js</a> in Javascript.</p>
            <p><a href="https://github.com/ankurp/Cent">Cent</a> is a library that extends certain Swift object types using the extension feature and gives its two cents to Swift language. It is now moved into a separate repo to support <code>Swift Package Manager</code></p>
            <p>NOTE: Starting Swift 4 <code>$</code> is no longer a valid identifier. So you get the following <code>error: '$' is not an identifier; use backticks to escape it</code> You will need to espace <code>$</code> identifier using backticks.</p>
            <h2 id="contents">Contents</h2>
            <ul>
                <li><a href="#setup">Setup</a>
                    <ul>
                        <li><a href="#demo-app">Demo App</a></li>
                    </ul>
                </li>
                <li><a href="http://www.dollarswift.org">API Documentation</a></li>
                <li><a href="#dollar-usage">Usage</a>
                    <ul>
                        <li><a href="#array">Array</a></li>
                        <li><a href="#dictionary">Dictionary</a></li>
                        <li><a href="#object">Object</a></li>
                        <li><a href="#function">Function</a></li>
                        <li><a href="#chaining" class="">Chaining</a></li>
                    </ul>
                </li>
                <li><a href="#contributing">Contributing</a></li>
            </ul>
            <h1 id="setup">Setup</h1>
            <h2 id="using-cocoapods-version-0-36-x-or-greater">Using <a href="http://cocoapods.org/">cocoapods</a> version 0.36.x or greater</h2>
            <p>Add <code>pod 'Dollar'</code> to your <code>Podfile</code> and run <code>pod install</code>. Add <code>use_frameworks!</code> to the end of the <code>Podfile</code>. Also checkout this <a href="https://github.com/ankurp/DollarPodApp">sample app</a>.</p>
            <h2 id="using-swift-package-manager">Using <a href="https://github.com/apple/swift-package-manager">Swift Package Manager</a></h2>
            <p>Add the following dependency <code>.Package(url: "https://github.com/ankurp/Dollar", majorVersion: 7, minor: 1)</code> to your <code>Package.swift</code> file and then run <code>swift build</code>. Requires swift version 2.2 or greater that you can install from <a href="https://swift.org">https://swift.org</a></p>
            <h2 id="using-git-submodule">Using <code>git submodule</code></h2>
            <ol>
                <li>If you are using git then add Dollar as a submodule using <code>git submodule add https://github.com/ankurp/Dollar.git</code>. If not using git download the project using <code>git clone https://github.com/ankurp/Dollar.git</code> in your project folder.</li>
                <li>Open the <code>Dollar</code> folder. Drag Dollar.xcodeproj, inside the Dollar folder, into the file navigator of your Xcode project.</li>
                <li>In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the “Targets” heading in the sidebar.</li>
                <li>In the tab bar at the top of that window, open the “Build Phases” panel.</li>
                <li>Expand the “Link Binary with Libraries” group, and add Dollar.framework.</li>
                <li>In your project file <code>import Dollar</code> and you can call all of the helper functions.</li>
            </ol>
            <p>Still stuck. Then checkout this screencast on <a href="http://recordit.co/0gQiCSEREF">how to import</a></p>
            <h2 id="support-for-xcode-and-swift">Support for Xcode and Swift</h2>
            <ul>
                <li>For Xcode 9 (Swift 4) user version <code>7.1.0</code></li>
                <li>For Xcode 8 (Swift 3) user version <code>6.0.0</code></li>
                <li>For Xcode 7 (Swift 2) use version <code>4.1.0</code> or <code>5.2.0</code></li>
                <li>For Xcode 6.3 (Swift 1.2) use version <code>3.0.3</code></li>
                <li>For Xcode 6.1 and 6.2 (Swift 1.1) use version <code>2.2.0</code></li>
            </ul>
            <h2 id="demo-apps">Demo Apps</h2>
            <ul>
                <li>Using <a href="https://github.com/ankurp/DollarPodApp"><code>Cocoa Pods</code></a></li>
                <li>Using <a href="https://github.com/ankurp/DollarSwiftPackage"><code>Swift Package Manager</code></a></li>
                <li>Using <a href="https://github.com/ankurp/DollarSubmoduleApp"><code>git submodule</code></a></li>
            </ul>
            <h2 id="communication">Communication</h2>
            <ul>
                <li>If you <strong>need help</strong>, use <a href="https://gitter.im/ankurp/Dollar">gitter.im</a> or post a question on <a href="http://stackoverflow.com/questions/tagged/dollar.swift">Stack Overflow</a> with tag <code>dollar.swift</code>.</li>
                <li>If you’d like to <strong>ask a general question</strong>, use <a href="http://stackoverflow.com/questions/tagged/dollar.swift">Stack Overflow</a>.</li>
                <li>If you <strong>found a bug</strong>, open an issue.</li>
                <li>If you <strong>have a feature request</strong>, open an issue.</li>
                <li>If you <strong>want to contribute</strong>, submit a pull request.</li>
            </ul>
            <h1 id="dollar-usage">Dollar Usage</h1>
            <h2 id="array">Array</h2>
            <h3 id="at-dollar-at">at - <code>Dollar.at</code></h3>
            <p>Creates an array of elements from the specified indexes, or keys, of the collection. Indexes may be specified as individual arguments or as arrays of indexes.</p><pre><code class="lang-swift">Dollar.at([<span class="string">"ant"</span>, <span class="string">"bat"</span>, <span class="string">"cat"</span>, <span class="string">"dog"</span>, <span class="string">"egg"</span>], indexes: <span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>) 
=&gt; [<span class="string">"ant"</span>, <span class="string">"cat"</span>, <span class="string">"egg"</span>]</code></pre>
            <h3 id="chunk-dollar-chunk">chunk - <code>Dollar.chunk</code></h3>
            <p>Creates an array of elements split into groups the length of size. If array can’t be split evenly, the final chunk will be the remaining elements.</p><pre><code class="lang-swift">Dollar.chunk([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], size: <span class="number">2</span>)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]]

Dollar.chunk([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], size: <span class="number">3</span>)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>]]</code></pre>
            <h3 id="compact-dollar-compact">compact - <code>Dollar.compact</code></h3>
            <p>Creates an array with all nil values removed.</p><pre><code class="lang-swift">Dollar.compact([<span class="number">3</span>, nil, <span class="number">4</span>, <span class="number">5</span>]) 
=&gt; [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]

Dollar.compact([nil, nil]) as NSObject[] 
=&gt; []</code></pre>
            <h3 id="contains-dollar-contains">contains - <code>Dollar.contains</code></h3>
            <p>Checks if a given value is present in the array.</p><pre><code class="lang-swift">Dollar.contains([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], value: <span class="number">2</span>) 
=&gt; <span class="keyword">true</span>

Dollar.contains([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], value: <span class="number">10</span>) 
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="cycle-dollar-cycle">cycle - <code>Dollar.cycle</code></h3>
            <p>Cycles through the array definetly or indefinetly passing each element into the callback function. The second parameter is to specify how many times to cycle through the array. If left out it will cycle indefinetly.</p><pre><code class="lang-swift">Dollar.cycle([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], <span class="number">2</span>) {
  print(<span class="keyword">$</span><span class="number">0</span>)
}
<span class="comment">// Prints the following</span>
<span class="number">123123</span></code></pre>
            <h3 id="difference-dollar-difference">difference - <code>Dollar.difference</code></h3>
            <p>Creates an array excluding all values of the provided arrays</p><pre><code class="lang-swift">Dollar.difference([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], [<span class="number">5</span>, <span class="number">2</span>, <span class="number">10</span>]) 
=&gt; [<span class="number">1</span>, <span class="number">3</span>, <span class="number">4</span>]</code></pre>
            <h3 id="each-dollar-each">each - <code>Dollar.each</code></h3>
            <p>Passes each element in the array to the callback</p><pre><code class="lang-swift">Dollar.each([<span class="string">"A"</span>, <span class="string">"B"</span>]) { 
  print(<span class="string">"Value \(<span class="keyword">$</span><span class="number">0</span>)"</span>)
}
=&gt; [<span class="string">"A"</span>, <span class="string">"B"</span>]

Dollar.each([<span class="string">"A"</span>, <span class="string">"B"</span>]) { (index, elem) in
  print(<span class="string">"\(index) - \(elem)"</span>)
}
=&gt; [<span class="string">"<span class="number">0</span> - A"</span>, <span class="string">"<span class="number">1</span> - B"</span>]</code></pre>
            <h3 id="every-dollar-every">every - <code>Dollar.every</code></h3>
            <p>Checks if the given callback returns true value for all items in the array.</p><pre><code class="lang-swift">Dollar.every([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], callback: { <span class="keyword">$</span><span class="number">0</span> &lt; <span class="number">20</span> }) 
=&gt; <span class="keyword">true</span>

Dollar.every([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]) { <span class="keyword">$</span><span class="number">0</span> == <span class="number">1</span> } 
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="factorial-dollar-factorial">factorial <code>Dollar.factorial</code></h3>
            <p>Returns factorial of integer</p><pre><code class="lang-swift">Dollar.factorial(<span class="number">3</span>)
=&gt; <span class="number">6</span>

Dollar.factorial(<span class="number">0</span>)
=&gt; <span class="number">1</span></code></pre>
            <h3 id="fetch-dollar-fetch">fetch - <code>Dollar.fetch</code></h3>
            <p>Get element from an array at the given index which can be negative to find elements from the end of the array. A default value can be returned if indexing out of bounds.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>]
Dollar.fetch(arr, <span class="number">100</span>)
=&gt; nil

Dollar.fetch(arr, <span class="number">100</span>, orElse: <span class="number">42</span>)
=&gt; <span class="number">42</span>

Dollar.fetch(arr, -<span class="number">1</span>)
=&gt; <span class="number">8</span></code></pre>
            <h3 id="fill-dollar-fill">fill - <code>Dollar.fill</code></h3>
            <p>Fills elements of array with value from start up to, but not including, end. This method mutates array.</p><pre><code class="lang-swift">var arr = Array&lt;Int&gt;(count: <span class="number">5</span>, repeatedValue: <span class="number">1</span>)
Dollar.fill(&amp;arr, withElem: <span class="number">42</span>)
=&gt; [<span class="number">42</span>, <span class="number">42</span>, <span class="number">42</span>, <span class="number">42</span>, <span class="number">42</span>]

var arr = Array&lt;Int&gt;(count: <span class="number">5</span>, repeatedValue: <span class="number">1</span>)
Dollar.fill(&amp;arr, withElem: <span class="number">42</span>, startIndex: <span class="number">1</span>, endIndex: <span class="number">3</span>)
=&gt; [<span class="number">1</span>, <span class="number">42</span>, <span class="number">42</span>, <span class="number">42</span>, <span class="number">1</span>]</code></pre>
            <h3 id="find-dollar-find">find - <code>Dollar.find</code></h3>
            <p>Iterates over elements of an array and returning the first element that the callback returns true for.</p><pre><code class="lang-swift">Dollar.find([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], callback: { <span class="keyword">$</span><span class="number">0</span> == <span class="number">2</span> }) 
=&gt; <span class="number">2</span>

Dollar.find([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]) { <span class="keyword">$</span><span class="number">0</span> == <span class="number">10</span> } 
=&gt; nil</code></pre>
            <h3 id="findindex-dollar-findindex">findIndex - <code>Dollar.findIndex</code></h3>
            <p>This method is like find except that it returns the index of the first element that passes the callback check.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [[<span class="string">"age"</span>: <span class="number">36</span>], [<span class="string">"age"</span>: <span class="number">40</span>], [<span class="string">"age"</span>: <span class="number">1</span>]]
<span class="keyword">let</span> result = Dollar.findIndex(arr) { <span class="keyword">$</span><span class="number">0</span>[<span class="string">"age"</span>] &lt; <span class="number">20</span> }
result 
=&gt; <span class="number">2</span></code></pre>
            <h3 id="findlastindex-dollar-findlastindex">findLastIndex - <code>Dollar.findLastIndex</code></h3>
            <p>This method is like findIndex except that it iterates over elements of the array from right to left.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [[<span class="string">"age"</span>: <span class="number">36</span>], [<span class="string">"age"</span>: <span class="number">40</span>], [<span class="string">"age"</span>: <span class="number">1</span>]]
<span class="keyword">let</span> result = Dollar.findLastIndex(arr) { <span class="keyword">$</span><span class="number">0</span>[<span class="string">"age"</span>] &gt; <span class="number">30</span> }
result
=&gt; <span class="number">1</span></code></pre>
            <h3 id="first-dollar-first-array-anyobject">first - <code>Dollar.first(array: AnyObject[])</code></h3>
            <p>Gets the first element in the array.</p><pre><code class="lang-swift">Dollar.first([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
=&gt; <span class="number">1</span>

Dollar.first([]) 
=&gt; nil</code></pre>
            <h3 id="groupby-dollar-groupby">groupBy <code>Dollar.groupBy</code></h3>
            <p>This method returns a dictionary of values grouped by the value returned by a callback.</p><pre><code class="lang-swift">Dollar.groupBy([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], callback: {<span class="keyword">$</span><span class="number">0</span> % <span class="number">2</span>})
=&gt; [<span class="number">0</span>: [<span class="number">2</span>, <span class="number">4</span>], <span class="number">1</span>: [<span class="number">1</span>, <span class="number">3</span>]]

Dollar.groupBy([<span class="string">"strings"</span>, <span class="string">"with"</span>, <span class="string">"different"</span>, lengths<span class="string">"], callback: {<span class="keyword">$</span><span class="number">0</span>.characters.count})
=&gt; [<span class="number">7</span>: ["</span>strings<span class="string">", "</span>lengths<span class="string">"], <span class="number">9</span>: ["</span>different<span class="string">"], <span class="number">4</span>: ["</span>With"]]</code></pre>
            <h3 id="second-dollar-second-array-anyobject">second - <code>Dollar.second(array: AnyObject[])</code></h3>
            <p>Gets the second element in the array.</p><pre><code class="lang-swift">Dollar.second([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
=&gt; <span class="number">2</span>

Dollar.second([<span class="number">1</span>]) 
=&gt; nil

Dollar.second([])
=&gt; nil</code></pre>
            <h3 id="flatmap-dollar-flatmap">flatMap - <code>Dollar.flatMap</code></h3>
            <p>Maps a function that converts elements to a list and then concatenates them.</p><pre><code class="lang-swift"><span class="keyword">let</span> values = [<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]
Dollar.flatMap(values) { [<span class="keyword">$</span><span class="number">0</span>, <span class="keyword">$</span><span class="number">0</span>] }
=&gt; [<span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">7</span>]</code></pre>
            <h3 id="flatmap-dollar-flatmap">flatMap - <code>Dollar.flatMap</code></h3>
            <p>Maps a function that converts a type to an Optional over an Optional, and then returns a single-level Optional.</p><pre><code class="lang-swift"><span class="keyword">let</span> url = NSURL(string: <span class="string">"https:<span class="comment">//apple.com/swift"</span>)</span>
Dollar.flatMap(url) { <span class="keyword">$</span><span class="number">0</span>.lastPathComponent }
=&gt; Optional(<span class="string">"swift"</span>)</code></pre>
            <p><em>Note</em>: This is the same behavior as Optional chaining. The code above translates to</p><pre><code class="lang-swift">NSURL(string: <span class="string">"https:<span class="comment">//apple.com/swift/"</span>)?.lastPathComponent</span>
=&gt; Optional(<span class="string">"swift"</span>)</code></pre>
            <h3 id="flatten-dollar-flatten">flatten - <code>Dollar.flatten</code></h3>
            <p>Flattens a nested array of any depth.</p><pre><code class="lang-swift">Dollar.flatten([[<span class="number">3</span>], <span class="number">4</span>, <span class="number">5</span>]) as Int[] 
=&gt; [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]

Dollar.flatten([[<span class="number">3</span>], <span class="string">"Hello"</span>, <span class="number">5</span>]) as NSObject[] 
=&gt; [<span class="number">3</span>, <span class="string">"Hello"</span>, <span class="number">5</span>]

Dollar.flatten([[[<span class="number">3</span>], <span class="number">4</span>], <span class="number">5</span>]) as Int[] 
=&gt; [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]</code></pre>
            <h3 id="frequencies-dollar-frequencies">frequencies - <code>Dollar.frequencies</code></h3>
            <p>This method returns a dictionary of values in an array mapping to the total number of occurrences in the array. If passed a function it returns a frequency table of the results of the given function on the arrays elements.</p><pre><code class="lang-swift">Dollar.frequencies([<span class="string">"a"</span>, <span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>, <span class="string">"a"</span>, <span class="string">"b"</span>]) 
=&gt; [<span class="string">"a"</span>: <span class="number">3</span>, <span class="string">"b"</span>: <span class="number">2</span>, <span class="string">"c"</span>: <span class="number">1</span>]

Dollar.frequencies([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]) { <span class="keyword">$</span><span class="number">0</span> % <span class="number">2</span> == <span class="number">0</span> }
=&gt; [<span class="keyword">false</span>: <span class="number">3</span>, <span class="keyword">true</span>: <span class="number">2</span>]</code></pre>
            <h3 id="gcd-dollar-gcd">gcd <code>Dollar.gcd</code></h3>
            <p>GCD function return greatest common denominator with number passed</p><pre><code class="lang-swift">Dollar.gcd(<span class="number">3</span>, <span class="number">10</span>)
=&gt; <span class="number">1</span>

Dollar.gcd(<span class="number">3</span>, <span class="number">9</span>)
=&gt; <span class="number">3</span></code></pre>
            <h3 id="indexof-dollar-indexof">indexOf - <code>Dollar.indexOf</code></h3>
            <p>Gets the index at which the first occurrence of value is found.</p><pre><code class="lang-swift">Dollar.indexOf([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], value: <span class="number">2</span>) 
=&gt; <span class="number">1</span>

Dollar.indexOf([<span class="string">"A"</span>, <span class="string">"B"</span>, <span class="string">"C"</span>], value: <span class="string">"B"</span>) 
=&gt; <span class="number">1</span>

Dollar.indexOf([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], value: <span class="number">5</span>) 
=&gt; <span class="number">2</span>

Dollar.indexOf([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], value: <span class="number">3</span>) 
=&gt; <span class="number">0</span>

Dollar.indexOf([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], value: <span class="number">2</span>) 
=&gt; nil</code></pre>
            <h3 id="initial-dollar-initial">initial - <code>Dollar.initial</code></h3>
            <p>Gets all but the last element or last n elements of an array.</p><pre><code class="lang-swift">Dollar.initial([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]) 
=&gt; [<span class="number">3</span>, <span class="number">4</span>]

Dollar.initial([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], numElements: <span class="number">2</span>) 
=&gt; [<span class="number">3</span>]</code></pre>
            <h3 id="intersection-dollar-intersection">intersection - <code>Dollar.intersection</code></h3>
            <p>Creates an array of unique values present in all provided arrays.</p><pre><code class="lang-swift">Dollar.intersection([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">5</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">1</span>]) 
=&gt; [<span class="number">1</span>, <span class="number">2</span>]</code></pre>
            <h3 id="it-isin-dollar-it-t-comparable-i-t-isin-range-range-t">it-isIn <code>Dollar.it&lt;T: Comparable&gt;(i: T, isIn range: Range&lt;T&gt;)</code></h3>
            <p>Returns true if i is in interval or range</p><pre><code class="lang-swift">Dollar.it(<span class="string">"c"</span>, isIn: <span class="string">"a"</span>...<span class="string">"z"</span>)
=&gt; <span class="keyword">true</span>

Dollar.it(<span class="string">"z"</span>, isIn: <span class="string">"a"</span>..&lt;<span class="string">"z"</span>)
=&gt; <span class="keyword">false</span>

Dollar.it(<span class="number">1</span>, isIn: -<span class="number"><span class="number">1</span>.<span class="number">0</span></span>...<span class="number"><span class="number">10</span>.<span class="number">0</span></span>)
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="last-dollar-last">last - <code>Dollar.last</code></h3>
            <p>Gets the last element from the array.</p><pre><code class="lang-swift">Dollar.last([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]) 
=&gt; <span class="number">5</span></code></pre>
            <h3 id="lastindexof-dollar-lastindexof">lastIndexOf - <code>Dollar.lastIndexOf</code></h3>
            <p>Gets the index at which the last occurrence of value is found.</p><pre><code class="lang-swift">Dollar.lastIndexOf([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], value: <span class="number">2</span>) 
=&gt; <span class="number">4</span></code></pre>
            <h3 id="lcm-dollar-lcm">lcm <code>Dollar.lcm</code></h3>
            <p>LCM method return least common multiple with number passed</p><pre><code class="lang-swift">Dollar.lcm(<span class="number">3</span>, <span class="number">10</span>)
=&gt; <span class="number">30</span>

Dollar.lcm(<span class="number">3</span>, <span class="number">9</span>)
=&gt; <span class="number">9</span></code></pre>
            <h3 id="rest-dollar-rest">rest - <code>Dollar.rest</code></h3>
            <p>The opposite of initial this method gets all but the first element or first n elements of an array.</p><pre><code class="lang-swift">Dollar.rest([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]) 
=&gt; [<span class="number">4</span>, <span class="number">5</span>]

Dollar.rest([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], numElements: <span class="number">2</span>) 
=&gt; [<span class="number">5</span>]</code></pre>
            <h3 id="map-dollar-map">map - <code>Dollar.map</code></h3>
            <p>Maps each element to new value based on the map function passed</p><pre><code class="lang-swift">Dollar.map([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]) { 
  <span class="keyword">$</span><span class="number">0</span> * <span class="number">2</span>
}
=&gt; [<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">8</span>]</code></pre>
            <h3 id="min-dollar-min">min - <code>Dollar.min</code></h3>
            <p>Retrieves the minimum value in an array.</p><pre><code class="lang-swift">Dollar.min([<span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]) 
=&gt; <span class="number">1</span></code></pre>
            <h3 id="max-dollar-max">max - <code>Dollar.max</code></h3>
            <p>Retrieves the maximum value in an array.</p><pre><code class="lang-swift">Dollar.max([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">2</span>, <span class="number">1</span>]) 
=&gt; <span class="number">4</span></code></pre>
            <h3 id="pluck-dollar-pluck">pluck - <code>Dollar.pluck</code></h3>
            <p>Retrieves the value of a specified property from all elements in the array.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [[<span class="string">"age"</span>: <span class="number">20</span>], [<span class="string">"age"</span>: <span class="number">30</span>], [<span class="string">"age"</span>: <span class="number">40</span>]]
Dollar.pluck(arr, value: <span class="string">"age"</span>) 
=&gt; [<span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>]</code></pre>
            <h3 id="pull-dollar-pull">pull - <code>Dollar.pull</code></h3>
            <p>Removes all provided values from the given array.</p><pre><code class="lang-swift">Dollar.pull([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">3</span>, <span class="number">5</span>) 
=&gt; [<span class="number">4</span>]

Dollar.pull([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">4</span>) 
=&gt; [<span class="number">3</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>]

Dollar.pull([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>) 
=&gt; []</code></pre>
            <h3 id="pullat-dollar-pullat">pullAt - <code>Dollar.pullAt</code></h3>
            <p>Removes all provided values from the given array at the given indices</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">40</span>, <span class="number">50</span>]
Dollar.pullAt(arr, indices: <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>)</code></pre>
            <h3 id="range-dollar-range">range - <code>Dollar.range</code></h3>
            <p>Creates an array of numbers (positive and/or negative) progressing from start up to but not including end.</p><pre><code class="lang-swift">Dollar.range(<span class="number">4</span>) 
=&gt; [<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]

Dollar.range(from: <span class="number">1</span>, to: <span class="number">5</span>) 
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]

Dollar.range(from: <span class="number">0</span>, to: <span class="number">20</span>, incrementBy: <span class="number">5</span>) 
=&gt; [<span class="number">0</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">15</span>]

Dollar.range(from: <span class="number">1</span>, through: <span class="number">5</span>)
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]

Dollar.range(from: <span class="number">0</span>, through: <span class="number">20</span>, incrementBy: <span class="number">5</span>)
=&gt; [<span class="number">0</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">15</span>, <span class="number">20</span>]</code></pre>
            <h3 id="reduce-dollar-reduce">reduce - <code>Dollar.reduce</code></h3>
            <p>Reduce function that will resolve to one value after performing combine function on all elements</p><pre><code class="lang-swift">Dollar.reduce([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], initial: <span class="number">0</span>) { (total, element) in
    total + element
}
=&gt; <span class="number">6</span></code></pre>
            <h3 id="sample-dollar-sample">sample - <code>Dollar.sample</code></h3>
            <p>Returns a sample item from the array</p><pre><code class="lang-swift"><span class="keyword">let</span> arr : Int[] = [<span class="number">2</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]
Dollar.contains(arr, value: Dollar.sample(arr))
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="sequence-dollar-sequence">sequence - <code>Dollar.sequence</code></h3>
            <p>Creates an array of an arbitrary sequence. Especially useful with builtin ranges.</p><pre><code class="lang-swift">Dollar.sequence(<span class="number">0</span>..<span class="number">4</span>) 
=&gt; [<span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]

Dollar.sequence(-<span class="number"><span class="number">2</span>.<span class="number">0</span></span>..<span class="number"><span class="number">2</span>.<span class="number">0</span></span>) 
=&gt; [-<span class="number"><span class="number">2</span>.<span class="number">0</span></span>, -<span class="number"><span class="number">1</span>.<span class="number">0</span></span>, <span class="number"><span class="number">0</span>.<span class="number">0</span></span>, <span class="number"><span class="number">1</span>.<span class="number">0</span></span>]

Dollar.sequence((<span class="number">0</span>..<span class="number">20</span>).by(<span class="number">5</span>)) 
=&gt; [<span class="number">0</span>, <span class="number">5</span>, <span class="number">10</span>, <span class="number">15</span>]

Dollar.sequence(<span class="string">"abc"</span>) 
=&gt; [<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>]</code></pre>
            <h3 id="remove-dollar-remove">remove - <code>Dollar.remove</code></h3>
            <p>Removes an element from array.</p><pre><code class="lang-swift">Dollar.remove([<span class="string">"A"</span>, <span class="string">"B"</span>, <span class="string">"C"</span>, <span class="string">"D"</span>], value: <span class="string">"B"</span>)
=&gt; [<span class="string">"A"</span>, <span class="string">"C"</span>, <span class="string">"D"</span>]</code></pre>
            <h3 id="remove-dollar-remove">remove - <code>Dollar.remove</code></h3>
            <p>Removes all elements from an array that the <code>callback</code> returns true.</p><pre><code class="lang-swift"><span class="keyword">let</span> result = Dollar.remove([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]) { 
  <span class="keyword">$</span><span class="number">0</span> == <span class="number">2</span> || <span class="keyword">$</span><span class="number">0</span> == <span class="number">3</span> 
}
result
=&gt; [<span class="number">1</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]</code></pre>
            <h3 id="shuffle-dollar-shuffle">shuffle - <code>Dollar.shuffle</code></h3>
            <p>Shuffles and returns the new shuffled array</p><pre><code class="lang-swift"><span class="keyword">let</span> result = Dollar.shuffle([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>])
result
=&gt; [<span class="number">4</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">2</span>]</code></pre>
            <h3 id="size-dollar-size">size - <code>Dollar.size</code></h3>
            <p>Returns size of the array</p><pre><code class="lang-swift">Dollar.size([<span class="string">"a"</span>, <span class="string">"b"</span>, <span class="string">"c"</span>)
=&gt; <span class="number">3</span></code></pre>
            <h3 id="sortedindex-dollar-sortedindex">sortedIndex - <code>Dollar.sortedIndex</code></h3>
            <p>Gives the smallest index at which a value should be inserted into a given the array is sorted.</p><pre><code class="lang-swift">Dollar.sortedIndex([<span class="number">3</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">10</span>], value: <span class="number">5</span>)
=&gt; <span class="number">2</span>

Dollar.sortedIndex([<span class="number">10</span>, <span class="number">20</span>, <span class="number">30</span>, <span class="number">50</span>], value: <span class="number">40</span>)
=&gt; <span class="number">3</span></code></pre>
            <h3 id="transpose-dollar-transpose">transpose - <code>Dollar.transpose</code></h3>
            <p>Creates a tranposed matrix.</p><pre><code class="lang-swift">Dollar.transpose([[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]])
=&gt; [[<span class="number">1</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">5</span>], [<span class="number">3</span>, <span class="number">6</span>]]</code></pre>
            <h3 id="union-dollar-union">union - <code>Dollar.union</code></h3>
            <p>Creates an array of unique values, in order, of the provided arrays.</p><pre><code class="lang-swift">Dollar.union([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">5</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">1</span>]) 
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">5</span>, <span class="number">4</span>]</code></pre>
            <h3 id="merge-dollar-merge">merge - <code>Dollar.merge</code></h3>
            <p>Creates an array of all values, including duplicates, of the arrays in the order they are provided.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr  = [<span class="number">1</span>, <span class="number">5</span>]
<span class="keyword">let</span> arr<span class="number">2</span> = [<span class="number">2</span>, <span class="number">4</span>]
<span class="keyword">let</span> arr<span class="number">3</span> = [<span class="number">5</span>, <span class="number">6</span>]
<span class="keyword">let</span> result = Dollar.merge(arr, arr<span class="number">2</span>, arr<span class="number">3</span>)
result
=&gt; [<span class="number">1</span>, <span class="number">5</span>, <span class="number">2</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]</code></pre>
            <h3 id="uniq-dollar-uniq">uniq - <code>Dollar.uniq</code></h3>
            <p>Creates a duplicate-value-free version of an array.</p><pre><code class="lang-swift">Dollar.uniq([<span class="number">1</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">3</span>, <span class="number">1</span>])
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]

Dollar.uniq([<span class="number">1</span>, <span class="number"><span class="number">2</span>.<span class="number">5</span></span>, <span class="number">3</span>, <span class="number"><span class="number">1</span>.<span class="number">5</span></span>, <span class="number">2</span>, <span class="number"><span class="number">3</span>.<span class="number">5</span></span>]) {
  floor(<span class="keyword">$</span><span class="number">0</span>)
}
=&gt; [<span class="number">1</span>, <span class="number"><span class="number">2</span>.<span class="number">5</span></span>, <span class="number">3</span>]</code></pre>
            <h3 id="without-dollar-without">without - <code>Dollar.without</code></h3>
            <p>Creates an array excluding all provided values.</p><pre><code class="lang-swift">Dollar.without([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">3</span>, <span class="number">5</span>)
=&gt; [<span class="number">4</span>]

Dollar.without([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">4</span>)
=&gt; [<span class="number">3</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>]

Dollar.without([<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">3</span>, <span class="number">5</span>], values: <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>)
=&gt; []</code></pre>
            <h3 id="xor-dollar-xor">xor - <code>Dollar.xor</code></h3>
            <p>Creates an array that is the symmetric difference of the provided arrays.</p><pre><code class="lang-swift">Dollar.xor([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>], [<span class="number">5</span>, <span class="number">2</span>, <span class="number">1</span>, <span class="number">4</span>])
=&gt; [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]</code></pre>
            <h3 id="zip-dollar-zip">zip - <code>Dollar.zip</code></h3>
            <p>Creates an array of grouped elements, the first of which contains the first elements of the given arrays.</p><pre><code class="lang-swift">Dollar.zip([<span class="string">"fred"</span>, <span class="string">"barney"</span>], [<span class="number">30</span>, <span class="number">40</span>], [<span class="keyword">true</span>, <span class="keyword">false</span>]) as [NSObject] 
=&gt; [[<span class="string">"fred"</span>, <span class="number">30</span>, <span class="keyword">true</span>], [<span class="string">"barney"</span>, <span class="number">40</span>, <span class="keyword">false</span>]]</code></pre>
            <h3 id="zipobject-dollar-zipobject">zipObject - <code>Dollar.zipObject</code></h3>
            <p>Creates an object composed from arrays of keys and values.</p><pre><code class="lang-swift">Dollar.zipObject([<span class="string">"fred"</span>, <span class="string">"barney"</span>], values: [<span class="number">30</span>, <span class="number">40</span>])
=&gt; [<span class="string">"fred"</span>: <span class="number">30</span>, <span class="string">"barney"</span>: <span class="number">40</span>]</code></pre>
            <h3 id="partition-dollar-partition">partition - <code>Dollar.partition</code></h3>
            <p>Produces an array of arrays, each containing n elements, each offset by step. Stops after a partition is less than n length.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]
Dollar.partition(arr, n: <span class="number">2</span>)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>], [<span class="number">3</span>, <span class="number">4</span>]]

Dollar.partition(arr, n: <span class="number">4</span>, step: <span class="number">1</span>)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]]

Dollar.partition(arr, n: <span class="number">4</span>, step: <span class="number">1</span>, pad: nil)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]]

Dollar.partition(arr, n: <span class="number">4</span>, step: <span class="number">1</span>, pad: [<span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>])
=&gt; [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]]</code></pre>
            <h3 id="partitionall-dollar-partitionall">partitionAll - <code>Dollar.partitionAll</code></h3>
            <p>Produces an array of arrays, each containing n elements, each offset by step. Continues after a partition is less than n length.</p><pre><code class="lang-swift">Dollar.partitionAll([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], n:<span class="number">4</span>, step: <span class="number">1</span>)
=&gt; [[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>], [<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], [<span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], [<span class="number">4</span>, <span class="number">5</span>], [<span class="number">5</span>]]</code></pre>
            <h3 id="partitionby-dollar-partitionby">partitionBy - <code>Dollar.partitionBy</code></h3>
            <p>Applies a function to each element in array, splitting it each time the function returns a new value.</p><pre><code class="lang-swift">Dollar.partitionBy([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>]) { <span class="keyword">$</span><span class="number">0</span> % <span class="number">2</span> == <span class="number">0</span> }
=&gt; [[<span class="number">1</span>], [<span class="number">2</span>, <span class="number">4</span>], [<span class="number">3</span>, <span class="number">5</span>], [<span class="number">6</span>]]

Dollar.partitionBy([<span class="number">1</span>, <span class="number">7</span>, <span class="number">3</span>, <span class="number">6</span>, <span class="number">10</span>, <span class="number">12</span>]) { <span class="keyword">$</span><span class="number">0</span> % <span class="number">3</span> }
=&gt; [[<span class="number">1</span>, <span class="number">7</span>], [<span class="number">3</span>, <span class="number">6</span>], [<span class="number">10</span>], [<span class="number">12</span>]]</code></pre>
            <h2 id="dictionary">Dictionary</h2>
            <h3 id="keys-dollar-keys">keys - <code>Dollar.keys</code></h3>
            <p>Creates an array of keys given a dictionary.</p><pre><code class="lang-swift">Dollar.keys([<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>])
=&gt; [<span class="string">"Dog"</span>, <span class="string">"Cat"</span>]</code></pre>
            <h3 id="values-dollar-values">values - <code>Dollar.values</code></h3>
            <p>Creates an array of values given a dictionary</p><pre><code class="lang-swift">Dollar.values([<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>])
=&gt; [<span class="number">1</span>, <span class="number">2</span>]</code></pre>
            <h3 id="merge-dollar-merge">merge - <code>Dollar.merge</code></h3>
            <p>Merges all of the dictionaries together and the latter dictionary overrides the value at a given key</p><pre><code class="lang-swift"><span class="keyword">let</span> dict: Dictionary&lt;String, Int&gt; = [<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>]
<span class="keyword">let</span> dict<span class="number">2</span>: Dictionary&lt;String, Int&gt; = [<span class="string">"Cow"</span>: <span class="number">3</span>]
<span class="keyword">let</span> dict<span class="number">3</span>: Dictionary&lt;String, Int&gt; = [<span class="string">"Sheep"</span>: <span class="number">4</span>]
Dollar.merge(dict, dict<span class="number">2</span>, dict<span class="number">3</span>)
=&gt; [<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>, <span class="string">"Cow"</span>: <span class="number">3</span>, <span class="string">"Sheep"</span>: <span class="number">4</span>]</code></pre>
            <h3 id="pick-dollar-pick">pick - <code>Dollar.pick</code></h3>
            <p>Creates a shallow clone of a dictionary composed of the specified keys.</p><pre><code class="lang-swift">Dollar.pick([<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>, <span class="string">"Cow"</span>: <span class="number">3</span>], keys: <span class="string">"Dog"</span>, <span class="string">"Cow"</span>)
=&gt; [<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cow"</span>: <span class="number">3</span>]</code></pre>
            <h3 id="omit-dollar-omit">omit - <code>Dollar.omit</code></h3>
            <p>Creates a shallow clone of a dictionary excluding the specified keys.</p><pre><code class="lang-swift">Dollar.omit([<span class="string">"Dog"</span>: <span class="number">1</span>, <span class="string">"Cat"</span>: <span class="number">2</span>, <span class="string">"Cow"</span>: <span class="number">3</span>, <span class="string">"Sheep"</span>: <span class="number">4</span>], keys: <span class="string">"Cat"</span>, <span class="string">"Dog"</span>)
=&gt; [<span class="string">"Cow"</span>: <span class="number">3</span>, <span class="string">"Sheep"</span>: <span class="number">4</span>]</code></pre>
            <h2 id="object">Object</h2>
            <h3 id="tap-dollar-tap">tap - <code>Dollar.tap</code></h3>
            <p>Invokes interceptor with the object and then returns object.</p><pre><code class="lang-swift">var beatle = Car(name: <span class="string">"Fusca"</span>)
Dollar.tap(beatle, {<span class="keyword">$</span><span class="number">0</span>.name = <span class="string">"Beatle"</span>}).color = <span class="string">"Blue"</span></code></pre>
            <h2 id="function">Function</h2>
            <h3 id="after-dollar-after">after - <code>Dollar.after</code></h3>
            <p>Creates a function that executes passed function only after being called n times.</p><pre><code class="lang-swift">var saves = [<span class="string">"profile"</span>, <span class="string">"settings"</span>];
<span class="keyword">let</span> asyncSave = { (function: () -&gt; ()?) in
   function() 
   <span class="comment">// Saving right away for testing </span>
   <span class="comment">// but in real world would be async</span>
}
var isDone = <span class="keyword">false</span>
var completeCallback = Dollar.after(saves.count) {
   isDone = <span class="keyword">true</span>
}
for elem in saves {
   asyncSave(completeCallback)
}
isDone 
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="bind-dollar-bind">bind - <code>Dollar.bind</code></h3>
            <p>Creates a function that, when called, invokes func with the binding of arguments provided.</p><pre><code class="lang-swift">var helloWorldFunc = Dollar.bind({(T...) in
  T[<span class="number">0</span>] + <span class="string">" "</span> + T[<span class="number">1</span>] + <span class="string">" from "</span> + T[<span class="number">2</span>] 
}, <span class="string">"Hello"</span>, <span class="string">"World"</span>, <span class="string">"Swift"</span>)
helloWorldFunc() 
=&gt; <span class="string">"Hello World from Swift"</span>

helloWorldFunc = Dollar.bind({ <span class="keyword">$</span><span class="number">0</span> + <span class="string">" World"</span> }, <span class="string">"Hello"</span>)
helloWorldFunc()
=&gt; <span class="string">"Hello World"</span>

helloWorldFunc = Dollar.bind({ <span class="keyword">$</span><span class="number">0</span> + <span class="keyword">$</span><span class="number">1</span> + <span class="string">" World"</span> }, <span class="string">"Hello "</span>, <span class="string">"Great"</span>)
helloWorldFunc()
=&gt; <span class="string">"Hello Great World"</span></code></pre>
            <h3 id="compose-dollar-compose">compose - <code>Dollar.compose</code></h3>
            <p>Compose two or more functions where the return value of the first function is passed into the next function. Useful when chaining functions and returns a function that can be called with variadic argument values or an array of values as input</p><pre><code class="lang-swift"><span class="keyword">let</span> double = { (params: Int...) -&gt; [Int] in
  return Dollar.map(params) { <span class="keyword">$</span><span class="number">0</span> * <span class="number">2</span> }
}
<span class="keyword">let</span> subtractTen = { (params: Int...) -&gt; [Int] in
  return Dollar.map(params) { <span class="keyword">$</span><span class="number">0</span> - <span class="number">10</span> }
}
<span class="keyword">let</span> doubleSubtractTen = Dollar.compose(double, subtractTen)
doubleSubtractTen(<span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>)
=&gt; [<span class="number">0</span>, <span class="number">2</span>, <span class="number">4</span>]

<span class="keyword">let</span> f = Dollar.compose({ (arr: [Int]) -&gt; [Int] in
  Dollar.map(arr) { <span class="keyword">$</span><span class="number">0</span> + <span class="number">1</span> }
}, { (arr: [Int]) -&gt; [Int] in
  Dollar.map(arr) { <span class="keyword">$</span><span class="number">0</span> * <span class="number">2</span> }
})
f([<span class="number">1</span>, <span class="number">2</span>])
=&gt; [<span class="number">4</span>, <span class="number">6</span>]</code></pre>
            <h3 id="curry-dollar-curry">curry - <code>Dollar.curry</code></h3>
            <p>Returns a function which when invoked either executes the function returning its result, if all function arguments have been provided, or returns another function that accepts one more argument of the remaining function arguments until all arguments are supplied. This is useful for making partial function as seen in these examples.</p><pre><code class="lang-swift">func adder(x: Int, y: Int, z: Int) -&gt; Int {
return x + y + z
}

<span class="keyword">let</span> curriedAdder = Dollar.curry(adder)
<span class="keyword">let</span> addTenAnd = curriedAdder(<span class="number">10</span>)
<span class="keyword">let</span> addThirtyAnd = addTenAnd(<span class="number">20</span>)
addThirtyAnd(<span class="number">1</span>)
=&gt; <span class="number">31</span>

addThirtyAnd(<span class="number">50</span>)
=&gt; <span class="number">80</span>

addTenAnd(<span class="number">10</span>)(<span class="number">10</span>)
=&gt; <span class="number">30</span></code></pre>
            <h3 id="id-dollar-id">id - <code>Dollar.id</code></h3>
            <p>The identify function which simply returns the argument its given.</p><pre><code class="lang-swift">Dollar.id(<span class="string">"Hello World from Swift"</span>)
=&gt; <span class="string">"Hello World from Swift"</span></code></pre>
            <h3 id="memoize-dollar-memoize">memoize - <code>Dollar.memoize</code></h3>
            <p>Returns a memoized function to improve performance by caching recursive function values.</p><pre><code class="lang-swift">var times = <span class="number">0</span> <span class="comment">// to test memoization</span>

<span class="keyword">let</span> fibMemo = Dollar.memoize { (fib: (Int -&gt; Int), val: Int) -&gt; Int in
  times += <span class="number">1</span>
  return val == <span class="number">1</span> || val == <span class="number">0</span> ? <span class="number">1</span> : fib(val - <span class="number">1</span>) + fib(val - <span class="number">2</span>)
}

<span class="keyword">let</span> x = fibMemo(<span class="number">5</span>)
times
=&gt; <span class="number">6</span>

times = <span class="number">0</span>
<span class="keyword">let</span> y = fibMemo(<span class="number">5</span>)
times
=&gt; <span class="number">0</span>

times = <span class="number">0</span>
<span class="keyword">let</span> z = fibMemo(<span class="number">6</span>)
times
=&gt; <span class="number">1</span></code></pre>
            <h3 id="noop-dollar-noop">noop - <code>Dollar.noop</code></h3>
            <p>A no-operation function.</p><pre><code class="lang-swift">Dollar.noop() 
=&gt; nil</code></pre>
            <h3 id="now-dollar-now">now - <code>Dollar.now</code></h3>
            <p>Gets the number of seconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).</p><pre><code class="lang-swift">Dollar.now() 
=&gt; <span class="number"><span class="number">1431911564</span>.<span class="number">292577</span></span></code></pre>
            <h3 id="once-dollar-once">once - <code>Dollar.once</code></h3>
            <p>Get a wrapper function that executes the passed function only once. Useful for getting shared config or creating singleton objects.</p><pre><code class="lang-swift">func createConfig() -&gt; [String: String] {
  var i = <span class="number">1</span>
  return [
    <span class="string">"App ID"</span>: <span class="string">"\(i++)"</span>,
    <span class="string">"URL"</span>: <span class="string">"https:<span class="comment">//someurl"</span></span>
  ]
}

<span class="keyword">let</span> getConfig = Dollar.once(createConfig)
getConfig()
=&gt; [<span class="string">"App ID"</span>: <span class="string">"<span class="number">1</span>"</span>, <span class="string">"URL"</span>: <span class="string">"https:<span class="comment">//someurl"</span>]</span>

getConfig()
=&gt; [<span class="string">"App ID"</span>: <span class="string">"<span class="number">1</span>"</span>, <span class="string">"URL"</span>: <span class="string">"https:<span class="comment">//someurl"</span>]</span></code></pre>
            <h3 id="partial-dollar-partial">partial - <code>Dollar.partial</code></h3>
            <p>Creates a function that, when called, invokes func with any additional partial arguments prepended to those provided to the new function.</p><pre><code class="lang-swift"><span class="keyword">let</span> partialFunc = Dollar.partial({(T...) in 
  T[<span class="number">0</span>] + <span class="string">" "</span> + T[<span class="number">1</span>] + <span class="string">" from "</span> + T[<span class="number">2</span>] 
}, <span class="string">"Hello"</span>)
partialFunc(<span class="string">"World"</span>, <span class="string">"Swift"</span>) 
=&gt; <span class="string">"Hello World from Swift"</span></code></pre>
            <h3 id="times-dollar-times">times - <code>Dollar.times</code></h3>
            <p>Call a function n times and also passes the index. If a value is returned in the function then the times method will return an array of those values.</p><pre><code class="lang-swift"><span class="keyword">let</span> fun = Dollar.bind({ (names: String...) -&gt; String in
   <span class="keyword">let</span> people = Dollar.join(names, separator: <span class="string">" from "</span>)
   return <span class="string">"Hello \(people)"</span>
   }, <span class="string">"Ankur"</span>, <span class="string">"Swift"</span>)
Dollar.times(<span class="number">2</span>, function: fun) as String[] 
=&gt; [<span class="string">"Hello Ankur from Swift"</span>, <span class="string">"Hello Ankur from Swift"</span>]</code></pre>
            <h2 id="chaining">Chaining</h2>
            <p><strong><code>Dollar.chain(...)</code></strong></p>
            <h3 id="any"><code>any</code></h3>
            <p>Returns true if callback function returns true for at least one element in the array</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])
chain.any({ (<span class="keyword">$</span><span class="number">0</span> as Int) &lt; <span class="number">2</span> })
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="all"><code>all</code></h3>
            <p>Returns true if callback function returns true for all elements in the array</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])
chain.all({ (<span class="keyword">$</span><span class="number">0</span> as Int) &lt; <span class="number">10</span> })
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="each"><code>each</code></h3>
            <p>Passes each element value to the callback function</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="string">"Hello"</span>, <span class="string">"World"</span>])
var strBuilder = <span class="string">""</span>
chain.each({ strBuilder += (<span class="keyword">$</span><span class="number">0</span> as String) }).value
strBuilder
=&gt; <span class="string">"HelloWorld"</span></code></pre>
            <h3 id="filter"><code>filter</code></h3>
            <p>Filters the arrary to elements for which the callback function returns true</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.filter({ (<span class="keyword">$</span><span class="number">0</span> as Int) &lt; <span class="number">3</span> }).value
=&gt; [<span class="number">1</span>, <span class="number">2</span>]</code></pre>
            <h3 id="first"><code>first</code></h3>
            <p>Returns the first element in the array and terminates the chain</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.first()
=&gt; <span class="number">1</span></code></pre>
            <h3 id="second"><code>second</code></h3>
            <p>Returns the second element in the array and terminates the chain</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.second()
=&gt; <span class="number">2</span></code></pre>
            <h3 id="third"><code>third</code></h3>
            <p>Returns the third element in the array and terminates the chain</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.third()
=&gt; <span class="number">3</span></code></pre>
            <h3 id="flatten"><code>flatten</code></h3>
            <p>Flattens a nested array of any depth.</p><pre><code class="lang-swift">var chain = Dollar.chain([[<span class="number">1</span>, [<span class="number">2</span>]], [<span class="number">3</span>], <span class="number">4</span>])
chain.flatten().value
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]</code></pre>
            <h3 id="initial"><code>initial</code></h3>
            <p>Gets all but the last element or last n elements of an array.</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.initial(<span class="number">2</span>).value
=&gt; [<span class="number">1</span>, <span class="number">2</span>]</code></pre>
            <h3 id="map"><code>map</code></h3>
            <p>Maps each element to the new value returned in the callback function</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.map({ (<span class="keyword">$</span><span class="number">0</span> as Int) * <span class="number">2</span> }).value
=&gt; [<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>, <span class="number">8</span>]</code></pre>
            <h3 id="size"><code>size</code></h3>
            <p>Returns size of the array and terminates the chain</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])
chain.map({ (<span class="keyword">$</span><span class="number">0</span> as Int) * <span class="number">2</span> }).size()
=&gt; <span class="number">4</span></code></pre>
            <h3 id="slice"><code>slice</code></h3>
            <p>Slices the array based on the start and end position. If an end position is not specified it will slice till the end of the array.</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>])
chain.slice(<span class="number">2</span>, end: <span class="number">4</span>).value
=&gt; [<span class="number">3</span>, <span class="number">4</span>]</code></pre>
            <h3 id="value"><code>value</code></h3>
            <p>Returns the value after evaluating all callbacks</p><pre><code class="lang-swift">var chain = Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>])
chain.value
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>]</code></pre>
            <p><strong>Chaining more than one method</strong></p><pre><code class="lang-swift">Dollar.chain([[<span class="number">1</span>, <span class="number">2</span>], <span class="number">3</span>, [[<span class="number">4</span>], <span class="number">5</span>]])
  .initial()
  .flatten()
  .first()
=&gt; <span class="number">1</span>

Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>])
  .filter { <span class="keyword">$</span><span class="number">0</span> % <span class="number">1</span> == <span class="number">0</span> }
  .map { <span class="keyword">$</span><span class="number">0</span> * <span class="number">2</span> }
  .all {<span class="keyword">$</span><span class="number">0</span> &lt; <span class="number">10</span>}
=&gt; <span class="keyword">false</span>

Dollar.chain([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>])
  .map({ <span class="keyword">$</span><span class="number">0</span> * <span class="number">2</span> })
  .flatten()
  .initial(<span class="number">2</span>).value
=&gt; [<span class="number">2</span>, <span class="number">4</span>, <span class="number">6</span>]</code></pre>
            <h1 id="cent-usage">Cent Usage</h1>
            <h2 id="array-extensions">Array Extensions</h2>
            <h3 id="elem-element-element"><code>&lt;&lt; elem: Element -&gt; [Element]</code></h3>
            <p>Overloaded operator to append element to an array or append elements from another array into the first array. Return array with the element appended in the end.</p><pre><code class="lang-swift">var array = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>]
array &lt;&lt; <span class="number">4</span>
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>]
array &lt;&lt; [<span class="number">5</span>, <span class="number">6</span>]
=&gt; [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>]</code></pre>
            <h3 id="at-indexes-int-element"><code>at(indexes: Int...) -&gt; [Element]</code></h3>
            <p>Creates an array of elements from the specified indexes, or keys, of the collection.</p><pre><code class="lang-swift"><span class="keyword">let</span> array = [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]
<span class="keyword">let</span> some = array.at(<span class="number">1</span>, <span class="number">3</span>)
=&gt; [<span class="string">"spam"</span>, <span class="string">"eggs"</span>]</code></pre>
            <h3 id="each-callback-element-element"><code>each(callback: (Element) -&gt; ()) -&gt; [Element]</code></h3>
            <p>For each item in the array invoke the callback by passing the elem</p><pre><code class="lang-swift"><span class="keyword">let</span> array = [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]
array.each {
  print(<span class="keyword">$</span><span class="number">0</span>)
}
=&gt; [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]</code></pre>
            <h3 id="eachwithindex-callback-int-element-element"><code>eachWithIndex(callback: (Int, Element) -&gt; ()) -&gt; [Element]</code></h3>
            <p>For each item in the array invoke the callback by passing the elem along with the index</p><pre><code class="lang-swift"><span class="keyword">let</span> array = [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]
array.each { (index, elem)
  print(<span class="string">"\(index) - \(elem)"</span>)
}
=&gt; [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]</code></pre>
            <h3 id="cycle-u-times-int-callback-element-u"><code>cycle&lt;U&gt;(times: Int, callback: (Element) -&gt; U)</code></h3>
            <p>Cycles through the array definetly or indefinetly passing each element into the callback function. The second parameter is to specify how many times to cycle through the array. If left out it will cycle indefinetly.</p><pre><code class="lang-swift">[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].cycle(<span class="number">2</span>) {
  print(<span class="keyword">$</span><span class="number">0</span>)
}
<span class="comment">// Prints the following</span>
<span class="number">123123</span>

[<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>].cycle {
  print(<span class="keyword">$</span><span class="number">0</span>)
}
<span class="comment">// Cycles in an infinite loop</span></code></pre>
            <h3 id="every-callback-element-bool-bool"><code>every(callback: (Element) -&gt; Bool) -&gt; Bool</code></h3>
            <p>Checks if the given callback returns true value for all items in the array.</p><pre><code class="lang-swift">[<span class="string">"angry"</span>, <span class="string">"hungry"</span>].every { (a: String) -&gt; (Bool) in 
  a.hasSuffix(<span class="string">"gry"</span>) 
}
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="indexof-t-equatable-value-t-int"><code>indexOf&lt;T: Equatable&gt;(value: T) -&gt; Int</code></h3>
            <p>Gets the index at which the first occurrence of value is found.</p><pre><code class="lang-swift"><span class="keyword">let</span> array = [<span class="string">"foo"</span>, <span class="string">"spam"</span>, <span class="string">"bar"</span>, <span class="string">"eggs"</span>]
array.indexOf(<span class="string">"spam"</span>)
=&gt; <span class="number">1</span>
array.indexOf(<span class="string">"None"</span>)
=&gt; nil</code></pre>
            <h3 id="fetch-index-int-orelse-t-none-t"><code>fetch(index: Int, orElse: T? = .None) -&gt; T!</code></h3>
            <p>Get element from an array at the given index which can be negative to find elements from the end of the array. A default value can be returned if indexing out of bounds.</p><pre><code class="lang-swift"><span class="keyword">let</span> arr = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>, <span class="number">6</span>, <span class="number">7</span>, <span class="number">8</span>]
arr.fetch(<span class="number">100</span>)
=&gt; nil

arr.fetch(<span class="number">100</span>, orElse: <span class="number">42</span>)
=&gt; <span class="number">42</span>

arr.fetch(-<span class="number">1</span>)
=&gt; <span class="number">8</span></code></pre>
            <h3 id="findindex-callback-element-bool-int"><code>findIndex(callback: (Element) -&gt; Bool) -&gt; Int?</code></h3>
            <p>This method is like find except that it returns the index of the first element that passes the callback check.</p><pre><code class="lang-swift"><span class="keyword">let</span> ind: int? = [<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"spam"</span>, <span class="string">"eggs"</span>].findIndex {
  <span class="keyword">$</span><span class="number">0</span>.length == <span class="number">4</span>
}
ind! == <span class="number">2</span> 
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="findlastindex-callback-element-bool-int"><code>findLastIndex(callback: (Element) -&gt; Bool) -&gt; Int?</code></h3>
            <p>This method is like findIndex except that it iterates over elements of the array from right to left.</p><pre><code class="lang-swift"><span class="keyword">let</span> ind: int? = [<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"spam"</span>, <span class="string">"eggs"</span>].findLastIndex {
  <span class="keyword">$</span><span class="number">0</span>.length == <span class="number">4</span> 
}
ind! == <span class="number">3</span> 
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="first-element"><code>first() -&gt; Element?</code></h3>
            <p>Gets the first element in the array.</p><pre><code class="lang-swift"><span class="keyword">let</span> first = [<span class="string">"foo"</span>, <span class="string">"bar"</span>].first()
=&gt; <span class="string">"foo"</span></code></pre>
            <h3 id="flatten-element"><code>flatten() -&gt; [Element]</code></h3>
            <p>Flattens a nested array of any depth.</p><pre><code class="lang-swift"><span class="keyword">let</span> unFlattened = [<span class="string">"foo"</span>, [<span class="string">"bar"</span>], [[<span class="string">"spam"</span>]], [[[<span class="string">"eggs"</span>]]] ]
<span class="keyword">let</span> flattened = unFlattened.flatten() 
=&gt; [<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"spam"</span>, <span class="string">"eggs"</span>]</code></pre>
            <h3 id="get-index-int-element"><code>get(index: Int) -&gt; Element?</code></h3>
            <p>Get element at index</p><pre><code class="lang-swift"><span class="keyword">let</span> element = [<span class="string">"foo"</span>, <span class="string">"bar"</span>].get(<span class="number">0</span>)
element!
=&gt; <span class="string">"foo"</span>

<span class="keyword">let</span> nothing = [<span class="string">"foo"</span>, <span class="string">"bar"</span>].get(<span class="number">1000</span>)
=&gt; nil</code></pre>
            <h3 id="initial-numelements-int-1-element"><code>initial(numElements: Int? = 1) -&gt; [Element]</code></h3>
            <p>Gets all but the last element or last n elements of an array.</p><pre><code class="lang-swift"><span class="keyword">let</span> initial = [<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"spam"</span>].initial(<span class="number">2</span>) 
=&gt; [<span class="string">"foo"</span>]</code></pre>
            <h3 id="last-element"><code>last() -&gt; Element?</code></h3>
            <p>Gets the last element from the array.</p><pre><code class="lang-swift"><span class="keyword">let</span> last = [<span class="string">"foo"</span>, <span class="string">"bar"</span>].last() 
=&gt; <span class="string">"bar"</span></code></pre>
            <h3 id="rest-numelements-int-1-element"><code>rest(numElements: Int? = 1) -&gt; [Element]</code></h3>
            <p>The opposite of initial this method gets all but the first element or first n elements of an array.</p><pre><code class="lang-swift"><span class="keyword">let</span> rest = [<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"spam"</span>].rest(<span class="number">2</span>)
=&gt; [<span class="string">"spam"</span>]</code></pre>
            <h3 id="min-t-comparable-t"><code>min&lt;T: Comparable&gt;() -&gt; T?</code></h3>
            <p>Retrieves the minimum value in an array.</p><pre><code class="lang-swift"><span class="keyword">let</span> min = [ <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span> ].min()
=&gt; <span class="number">0</span></code></pre>
            <h3 id="max-t-comparable-t"><code>max&lt;T: Comparable&gt;() -&gt; T?</code></h3>
            <p>Retrieves the maximum value in an array.</p><pre><code class="lang-swift"><span class="keyword">let</span> max = [ <span class="number">0</span>, <span class="number">1</span>, <span class="number">2</span>].max()
=&gt; <span class="number">2</span></code></pre>
            <h3 id="remove-t-equatable-value-t-t"><code>remove&lt;T: Equatable&gt;(value: T) -&gt; T?</code></h3>
            <p>Remove element from array</p><pre><code class="lang-swift">var arr = [<span class="string">"A"</span>, <span class="string">"B"</span>, <span class="string">"C"</span>, <span class="string">"D"</span>, <span class="string">"E"</span>]
arr.remove(<span class="string">"B"</span>)
=&gt; [<span class="string">"A"</span>, <span class="string">"C"</span>, <span class="string">"D"</span>, <span class="string">"E"</span>]</code></pre>
            <h3 id="contains-t-equatable-value-t-bool"><code>contains&lt;T:Equatable&gt;(value: T) -&gt; Bool</code></h3>
            <p>Checks if a given value is present in the array.</p><pre><code class="lang-swift">var arr = [<span class="string">"A"</span>, <span class="string">"B"</span>, <span class="string">"C"</span>, <span class="string">"D"</span>, <span class="string">"E"</span>]
arr.contains(<span class="string">"C"</span>)
=&gt; <span class="keyword">true</span>
arr.contains(<span class="string">"Z"</span>)
=&gt; <span class="keyword">false</span></code></pre>
            <h2 id="character-extensions">Character Extensions</h2>
            <h3 id="a-description-string"><code>"A".description -&gt; String</code></h3>
            <p>Get string description of Character</p><pre><code class="lang-swift"><span class="keyword">let</span> ch: Character = <span class="string">"A"</span>
<span class="keyword">let</span> str = ch.description
=&gt; <span class="string">"A"</span></code></pre>
            <h3 id="a-ord-int"><code>"A".ord -&gt; Int</code></h3>
            <p>Get int representation of character</p><pre><code class="lang-swift">Character(<span class="string">"A"</span>).ord
=&gt; <span class="number">65</span></code></pre>
            <h2 id="date-extensions">Date Extensions</h2>
            <h3 id="date-from-year-int-month-int-day-int-nsdate"><code>Date.from(#year: Int, month: Int, day: Int) -&gt; NSDate</code></h3>
            <p>Returns a new Date given the year month and day</p><pre><code class="lang-swift"><span class="keyword">let</span> date = Date.from(<span class="number">2014</span>, <span class="number">1</span>, <span class="number">1</span>) 
=&gt; <span class="string">"Jan <span class="number">1</span>, <span class="number">2014</span>, <span class="number">12</span>:<span class="number">00</span> AM"</span></code></pre>
            <h3 id="date-from-unix-double-nsdate"><code>Date.from(#unix: Double) -&gt; NSDate</code></h3>
            <p>Returns a new Date given the unix timestamp (timeIntervalSince1970)</p><pre><code class="lang-swift"><span class="keyword">let</span> date = Date.from(unix: <span class="number">1</span>_<span class="number">388</span>_<span class="number">552</span>_<span class="number"><span class="number">400</span>.<span class="number">0</span></span>)
=&gt; <span class="string">"Jan <span class="number">1</span>, <span class="number">2014</span>, <span class="number">12</span>:<span class="number">00</span> AM"</span></code></pre>
            <h3 id="date-parse-datestr-string-format-string-yyyy-mm-dd-nsdate"><code>Date.parse(dateStr: String, format: String = "yyyy-MM-dd") -&gt; NSDate</code></h3>
            <p>Parses the date based on the format and return a new Date</p><pre><code class="lang-swift"><span class="keyword">let</span> parsedDate = Date.parse(<span class="string">"<span class="number">2014</span>-<span class="number">01</span>-<span class="number">01</span>"</span>, format: <span class="string">"yyyy-MM-dd"</span>)
=&gt; <span class="string">"Jan <span class="number">1</span>, <span class="number">2014</span>, <span class="number">12</span>:<span class="number">00</span> AM"</span></code></pre>
            <h3 id="date-unix-date-nsdate-nsdate-double"><code>Date.unix(date: NSDate = NSDate()) -&gt; Double</code></h3>
            <p>Returns the unix timestamp of the date passed in or the current unix timestamp</p><pre><code class="lang-swift"><span class="keyword">let</span> currentUnix = Date.unix()
=&gt; <span class="number">1</span>,<span class="number">388</span>,<span class="number">552</span>,<span class="number"><span class="number">400</span>.<span class="number">0</span></span>

var otherNSDate = Date()
<span class="keyword">let</span> otherUnix = Date.unix(otherDate)
=&gt; <span class="number">1</span>,<span class="number">388</span>,<span class="number">552</span>,<span class="number"><span class="number">400</span>.<span class="number">0</span></span></code></pre>
            <h3 id="int-hour-fromnow-et-al"><code>Int.hour.fromNow</code> et al.</h3>
            <p>Use the following syntax to calculate dates and times based on the user’s current calendar. </p><pre><code class="lang-swift"><span class="number">1</span>.day.ago
=&gt; <span class="string">"Apr <span class="number">10</span>, <span class="number">2015</span>, <span class="number">11</span>:<span class="number">51</span> AM"</span>
<span class="number">4</span>.hours.fromNow
=&gt; <span class="string">"Apr <span class="number">11</span>, <span class="number">2015</span>, <span class="number">3</span>:<span class="number">51</span> PM"</span></code></pre>
            <h2 id="dictionary-extensions">Dictionary Extensions</h2>
            <h3 id="merge-k-v-dictionaries-dictionary-k-v"><code>merge&lt;K, V&gt;(dictionaries: Dictionary&lt;K, V&gt;...)</code></h3>
            <p>Merges the dictionary with dictionaries passed. The latter dictionaries will override values of the keys that are already set</p><pre><code class="lang-swift">var dic = [<span class="string">"foo"</span>: <span class="string">"bar"</span>] 
<span class="keyword">let</span> anotherDic = [<span class="string">"foo"</span>: <span class="string">"baz"</span>, <span class="string">"spam"</span>: <span class="string">"eggs"</span>]
dic.merge(anotherDic)
=&gt; [<span class="string">"foo"</span>: <span class="string">"baz"</span>, <span class="string">"spam"</span>: <span class="string">"eggs"</span>]</code></pre>
            <h2 id="int-extensions">Int Extensions</h2>
            <h3 id="times-callback-int"><code>times(callback: (Int) -&gt; ())</code></h3>
            <p>Invoke a callback n times with callback that takes index</p><pre><code class="lang-swift"><span class="number">5</span>.times { print(<span class="string">"Na"</span>) } 
=&gt; <span class="string">"NaNaNaNaNa"</span></code></pre>
            <h3 id="times-function"><code>times (function: () -&gt; ())</code></h3>
            <p>Invoke a callback n times</p><pre><code class="lang-swift"><span class="number">5</span>.times { (a: Int) -&gt; () in print(<span class="string">"\(a) "</span>) } 
=&gt; <span class="number">0</span> <span class="number">1</span> <span class="number">2</span> <span class="number">3</span> <span class="number">4</span></code></pre>
            <h3 id="char-character"><code>char -&gt; Character</code></h3>
            <p>Get ASCII character from integer</p><pre><code class="lang-swift"><span class="number">65</span>.char
=&gt; <span class="string">"A"</span></code></pre>
            <h3 id="iseven"><code>isEven</code></h3>
            <p>Check if int is even</p><pre><code class="lang-swift"><span class="number">2</span>.isEven
=&gt; <span class="keyword">true</span>

<span class="number">1</span>.isEven
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="isodd"><code>isOdd</code></h3>
            <p>Check if int is odd</p><pre><code class="lang-swift"><span class="number">3</span>.isOdd
=&gt; <span class="keyword">true</span>

<span class="number">2</span>.isOdd
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="digits-int"><code>digits() -&gt; [Int]</code></h3>
            <p>Splits the int into array of digits</p><pre><code class="lang-swift"><span class="number">4208</span>.digits()
=&gt; [<span class="number">4</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">8</span>]</code></pre>
            <h3 id="lcm-int"><code>lcm() -&gt; Int</code></h3>
            <p>LCM method return least common multiple with number passed</p><pre><code class="lang-swift"><span class="number">3</span>.lcm(<span class="number">10</span>)
=&gt; <span class="number">30</span>

<span class="number">3</span>.lcm(<span class="number">9</span>)
=&gt; <span class="number">9</span></code></pre>
            <h3 id="gcd-int"><code>gcd() -&gt; Int</code></h3>
            <p>GCD method return greatest common denominator with number passed</p><pre><code class="lang-swift"><span class="number">3</span>.gcd(<span class="number">10</span>)
=&gt; <span class="number">1</span>

<span class="number">3</span>.gcd(<span class="number">9</span>)
=&gt; <span class="number">3</span></code></pre>
            <h3 id="random-int"><code>random() -&gt; Int</code></h3>
            <p>Returns random number from 0 upto but not including value of integer</p><pre><code class="lang-swift"><span class="number">3</span>.random()
=&gt; <span class="number">2</span>

<span class="number">3</span>.random()
=&gt; <span class="number">1</span></code></pre>
            <h3 id="factorial-int"><code>factorial() -&gt; Int</code></h3>
            <p>Returns factorial of integer</p><pre><code class="lang-swift"><span class="number">3</span>.factorial()
=&gt; <span class="number">6</span>

<span class="number">0</span>.factorial()
=&gt; <span class="number">1</span></code></pre>
            <h3 id="isin-interval-bool"><code>isIn(interval) -&gt; Bool</code></h3>
            <p>Returns true if i is in interval or range</p><pre><code class="lang-swift"><span class="number">5</span>.isIn(<span class="number">1</span>...<span class="number">10</span>)
=&gt; <span class="keyword">true</span>

<span class="number">10</span>.isIn(<span class="number">1</span>..&lt;<span class="number">10</span>)
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="next-int"><code>next() -&gt; Int</code></h3>
            <p>Get the next int</p><pre><code class="lang-swift"><span class="number">10</span>.next()
=&gt; <span class="number">11</span></code></pre>
            <h3 id="prev-int"><code>prev() -&gt; Int</code></h3>
            <p>Get the previous int</p><pre><code class="lang-swift"><span class="number">10</span>.prev()
=&gt; <span class="number">9</span></code></pre>
            <h3 id="upto-limit-int-callback"><code>upTo(limit: Int, callback: () -&gt; ())</code></h3>
            <p>Invoke the callback from int up to and including limit</p><pre><code class="lang-swift"><span class="number">3</span>.upTo(<span class="number">5</span>) {
  print(<span class="string">"Hi"</span>)
}
Prints <span class="string">"HiHiHi"</span></code></pre>
            <h3 id="downto-limit-int-callback"><code>downTo(limit: Int, callback: () -&gt; ())</code></h3>
            <p>Invoke the callback from int down to and including limit</p><pre><code class="lang-swift"><span class="number">3</span>.downTo(<span class="number">0</span>) {
  print(<span class="string">"Hi"</span>)
}
Prints <span class="string">"HiHiHiHi"</span></code></pre>
            <h2 id="string-extensions">String Extensions</h2>
            <h3 id="length"><code>.length</code></h3>
            <p>Get the length of the string</p><pre><code class="lang-swift"><span class="string">"Hello"</span>.length
=&gt; <span class="number">5</span></code></pre>
            <h3 id="camelcase"><code>.camelCase</code></h3>
            <p>Get the camel case representation of the string</p><pre><code class="lang-swift"><span class="string">"__Dollar and cent-- dollarANDCent"</span>.camelCase
=&gt; <span class="string">"dollarAndCentDollarAndCent"</span></code></pre>
            <h3 id="kebabcase"><code>.kebabCase</code></h3>
            <p>Get the kebab case representation of the string</p><pre><code class="lang-swift"><span class="string">"__Dollar and cent-- dollarANDCent"</span>.kebabCase
=&gt; <span class="string">"dollar-and-cent-dollar-and-cent"</span></code></pre>
            <h3 id="snakecase"><code>.snakeCase</code></h3>
            <p>Get the snake case representation of the string</p><pre><code class="lang-swift"><span class="string">"__Dollar and cent-- dollarANDCent"</span>.snakeCase
=&gt; <span class="string">"dollar_and_cent_dollar_and_cent"</span></code></pre>
            <h3 id="startcase"><code>.startCase</code></h3>
            <p>Get the start case representation of the string</p><pre><code class="lang-swift"><span class="string">"__Dollar and cent-- dollarANDCent"</span>.startCase
=&gt; <span class="string">"Dollar And Cent Dollar And Cent"</span></code></pre>
            <h3 id="str-string-bool"><code>=~ str: String -&gt; Bool</code></h3>
            <p>Does a regex match of whether regex string on the right is matches the string on the left</p><pre><code class="lang-swift"><span class="string">"Dollar"</span> =~ <span class="string">"oll"</span>
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="n-int-string"><code>* n: Int -&gt; String</code></h3>
            <p>Get string concatenated <code>n</code> times</p><pre><code class="lang-swift"><span class="string">"Hi Swift! "</span> * <span class="number">3</span>
=&gt; <span class="string">"Hi Swift! Hi Swift! Hi Swift! "</span></code></pre>
            <h3 id="i-int-character"><code>[i: Int] -&gt; Character?</code></h3>
            <p>Get character at a subscript</p><pre><code class="lang-swift"><span class="string">"Hello World"</span>[<span class="number">6</span>] == <span class="string">"W"</span>
=&gt; <span class="keyword">true</span>

<span class="string">"Hi"</span>[<span class="number">5</span>]
=&gt; nil</code></pre>
            <h3 id="str-string-string"><code>[str: String] -&gt; String?</code></h3>
            <p>Returns the substring based on the first regex match passed in the subscript</p><pre><code class="lang-swift"><span class="keyword">let</span> proj = <span class="string">"Dollar and Cent"</span>
proj[<span class="string">"^.+[^and Cent]"</span>]
=&gt; {Some: <span class="string">"Dollar"</span>}</code></pre>
            <h3 id="r-range-int-string"><code>[r: Range&lt;Int&gt;] -&gt; String</code></h3>
            <p>Get substring using subscript notation and by passing a range</p><pre><code class="lang-swift"><span class="string">"Hello World"</span>[<span class="number">0</span>..&lt;<span class="number">5</span>] == <span class="string">"Hello"</span> 
=&gt; <span class="keyword">true</span></code></pre>
            <h3 id="indexof-char-character-int"><code>indexOf(char: Character) -&gt; Int?</code></h3>
            <p>Get the start index of character</p><pre><code class="lang-swift"><span class="string">"hello world"</span>.indexOf(Character(<span class="string">"o"</span>))!
=&gt; <span class="number">4</span></code></pre>
            <h3 id="indexof-str-string-int"><code>indexOf(str: String) -&gt; Int?</code></h3>
            <p>Get the start index of string</p><pre><code class="lang-swift"><span class="string">"hello world"</span>.indexOf(<span class="string">"llo"</span>)!
=&gt; <span class="number">2</span>

<span class="string">"hello world"</span>.indexOf(<span class="string">"illo"</span>)
=&gt; nil</code></pre>
            <h3 id="indexof-pattern-string-int"><code>indexOf(pattern: String) -&gt; Int?</code></h3>
            <p>Get the start index of regex pattern inside the string</p><pre><code class="lang-swift"><span class="string">"hello world"</span>.indexOf(<span class="string">".llo"</span>)!
=&gt; <span class="number">1</span></code></pre>
            <h3 id="split-delimiter-character-string"><code>split(delimiter: Character) -&gt; [String]</code></h3>
            <p>Get an array from string split using the delimiter character</p><pre><code class="lang-swift"><span class="string">"Hello World"</span>.split(<span class="string">" "</span>) 
=&gt; [<span class="string">"Hello"</span>, <span class="string">"World"</span>]</code></pre>
            <h3 id="lstrip-string"><code>lstrip() -&gt; String</code></h3>
            <p>Get string without leading spaces</p><pre><code class="lang-swift"><span class="keyword">let</span> leadingSpace = <span class="string">"  Hello"</span>
leadingSpace.lstrip()
=&gt; <span class="string">"Hello"</span></code></pre>
            <h3 id="rstrip-string"><code>rstrip() -&gt; String</code></h3>
            <p>Get string without trailing spaces</p><pre><code class="lang-swift"><span class="keyword">let</span> trailingSpace = <span class="string">"Hello   "</span>
trailingSpace.rstrip()
=&gt; <span class="string">"Hello"</span></code></pre>
            <h3 id="strip-string"><code>strip() -&gt; String</code></h3>
            <p>Get string without leading or trailing spaces</p><pre><code class="lang-swift"><span class="keyword">let</span> spaces = <span class="string">"   Hello   "</span>
spaces.strip()
=&gt; <span class="string">"Hello"</span></code></pre>
            <h2 id="regex">Regex</h2>
            <h3 id="init"><code>init</code></h3>
            <p>Init with regex pattern as string</p><pre><code class="lang-swift">Regex.init(<span class="string">"^Hello.World<span class="keyword">$</span>"</span>) <span class="comment">// Regex that matches <span class="string">"Hello World"</span></span></code></pre>
            <h3 id="matches-teststr-string-anyobject"><code>matches(testStr: String) -&gt; [AnyObject]</code></h3>
            <p>Return matches based on String passed.</p><pre><code class="lang-swift"><span class="keyword">let</span> re = Regex.init(<span class="string">"^Hello.World<span class="keyword">$</span>"</span>)
re.matches(<span class="string">"Hello World"</span>)</code></pre>
            <h3 id="test-teststr-string-bool"><code>test(testStr: String) -&gt; Bool</code></h3><pre><code class="lang-swift"><span class="keyword">let</span> re = Regex.init(<span class="string">"^Hello.World<span class="keyword">$</span>"</span>)
re.test(<span class="string">"Hello World"</span>)
=&gt; <span class="keyword">true</span>

re.test(<span class="string">"Str"</span>)
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="escapestr-str-string-string"><code>escapeStr(str: String) -&gt; String</code></h3>
            <p>Escape string with regex characters</p><pre><code class="lang-swift">Regex.escape(<span class="string">"Hello.World"</span>)
=&gt; <span class="string">"Hello\.World"</span></code></pre>
            <h2 id="range-extensions">Range Extensions</h2>
            <h3 id="equals">equals - <code>==</code></h3>
            <p>Check the equality of two ranges</p><pre><code class="lang-swift">(<span class="number">1</span>...<span class="number">5</span>) == (<span class="number">1</span>...<span class="number">5</span>) 
=&gt; <span class="keyword">true</span>

(<span class="number">1</span>..&lt;<span class="number">5</span>) == (<span class="number">1</span>...<span class="number">5</span>) 
=&gt; <span class="keyword">false</span></code></pre>
            <h3 id="eachwithindex-callback-t"><code>eachWithIndex(callback: (T) -&gt; ())</code></h3>
            <p>For each index in the range invoke the callback by passing the item in range</p><pre><code class="lang-swift">(<span class="number">1</span>...<span class="number">5</span>).eachWithIndex { (a: Int) -&gt; () in print(<span class="string">"\(a)"</span>) } 
=&gt; <span class="number">12345</span></code></pre>
            <h3 id="each-callback"><code>each(callback: () -&gt; ())</code></h3>
            <p>For each index in the range invoke the callback</p><pre><code class="lang-swift">(<span class="number">1</span>...<span class="number">5</span>).each { print(<span class="string">"Na"</span>) } 
=&gt; <span class="string">"NaNaNaNaNa"</span></code></pre>
            <h1 id="contributing">Contributing</h1>
            <p>If you are interested in contributing checkout <a href="https://github.com/ankurp/Dollar/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a></p>
        </div>
    </div>
    <script src="//www.google-analytics.com/ga.js" type="text/javascript"></script>
    <script type="text/javascript">
        try {
            var pageTracker = _gat._getTracker("UA-51727665-1");
            pageTracker._trackPageview();
        } catch (err) {}
    </script>

</body>

</html>